From dc0c2972e178a6de9ee87501acca54447ea9c699 Mon Sep 17 00:00:00 2001 From: Darren Kenny Date: Tue, 4 Jul 2017 08:26:01 +0100 Subject: [PATCH] Add LDoms Support. The current version of virt-what does not support discovery of any Logical Domains (LDoms) variants. This patch adds that support. Orabug: 26106813 Signed-off-by: Darren Kenny Reviewed-By: Liam Merwick Reviewed-By: Rashmi Narasimhan --- Makefile.am | 3 +++ tests/ldoms/dev/mdesc | 0 tests/ldoms/proc/cpuinfo | 0 tests/test-ldoms.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ virt-what.in | 20 ++++++++++++++++++++ virt-what.pod | 31 +++++++++++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 tests/ldoms/dev/mdesc create mode 100644 tests/ldoms/proc/cpuinfo create mode 100755 tests/test-ldoms.sh diff --git a/Makefile.am b/Makefile.am index 5cdb943..038a151 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,7 @@ TESTS = \ tests/test-kvm.sh \ tests/test-kvm-explicit-cpu.sh \ tests/test-linux-vserver.sh \ + tests/test-ldoms.sh \ tests/test-lkvm.sh \ tests/test-lkvm-arm.sh \ tests/test-lxc.sh \ @@ -103,6 +104,8 @@ EXTRA_DIST = \ tests/kvm-explicit-cpu/sbin/dmidecode \ tests/kvm-explicit-cpu/sbin/uname \ tests/kvm-explicit-cpu/sbin/virt-what-cpuid-helper \ + tests/ldoms/dev/mdesc \ + tests/ldoms/proc/cpuinfo \ tests/linux-vserver/proc/cpuinfo \ tests/linux-vserver/proc/self/status \ tests/linux-vserver/sbin/dmidecode \ diff --git a/tests/ldoms/dev/mdesc b/tests/ldoms/dev/mdesc new file mode 100644 index 0000000..e69de29 diff --git a/tests/ldoms/proc/cpuinfo b/tests/ldoms/proc/cpuinfo new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-ldoms.sh b/tests/test-ldoms.sh new file mode 100755 index 0000000..68c3c77 --- /dev/null +++ b/tests/test-ldoms.sh @@ -0,0 +1,44 @@ +# Test for LDoms +# Copyright (C) 2017 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +root=tests/ldoms + +# Include src dir in PATH +export PATH=.:${PATH} + +arch=$(uname -p | sed -e 's/i.86/i386/' | sed -e 's/arm.*/arm/') + +output="$(./virt-what --test-root=$root 2>&1)" +if [[ "${arch}" == sparc* ]]; then + expected="ldoms +ldoms-guest" +else + expected="" +fi + +if [ "$output" != "$expected" ]; then + echo "$0: test failed because output did not match expected" + echo "Expected output was:" + echo "----------------------------------------" + echo "$expected" + echo "----------------------------------------" + echo "But the actual output of the program was:" + echo "----------------------------------------" + echo "$output" + echo "----------------------------------------" + exit 1 +fi diff --git a/virt-what.in b/virt-what.in index 1d98eee..f525a89 100644 --- a/virt-what.in +++ b/virt-what.in @@ -358,3 +358,23 @@ fi if [ "$cpuid" = "OpenBSDVMM58" ]; then echo vmm fi + +# Check for LDoms +if [[ "$arch" == sparc* && -e ${root}/dev/mdesc ]]; then + echo ldoms + if [[ -d ${root}/sys/class/vlds/ctrl && \ + -d ${root}/sys/class/vlds/sp ]]; then + echo ldoms-control + else + echo ldoms-guest + fi + MDPROP="${root}/usr/lib/ldoms/mdprop.py" + if [[ -x ${MDPROP} ]]; then + if [[ -n $($MDPROP -v iodevice device-type=pciex) ]]; then + echo ldoms-root + echo ldoms-io + elif [[ -n $($MDPROP -v iov-device vf-id=0) ]]; then + echo ldoms-io + fi + fi +fi diff --git a/virt-what.pod b/virt-what.pod index d8b8ba9..78e5655 100644 --- a/virt-what.pod +++ b/virt-what.pod @@ -93,6 +93,37 @@ This is a KVM guest running on an IBM System Z hardware system. Status: contributed by Thomas Huth +=item B + +The guest appears to be running on an Linux SPARC system with +Oracle VM Server for SPARC (Logical Domains) support. + +Status: contributed by Darren Kenny + +=item B + +The is the Oracle VM Server for SPARC (Logical Domains) control domain. + +Status: contributed by Darren Kenny + +=item B + +The is the Oracle VM Server for SPARC (Logical Domains) guest domain. + +Status: contributed by Darren Kenny + +=item B + +The is the Oracle VM Server for SPARC (Logical Domains) I/O domain. + +Status: contributed by Darren Kenny + +=item B + +The is the Oracle VM Server for SPARC (Logical Domains) Root domain. + +Status: contributed by Darren Kenny + =item B This is printed for backwards compatibility with older virt-what which -- 1.8.3.1