Add LDoms Support.
authorDarren Kenny <Darren.Kenny@Oracle.COM>
Tue, 4 Jul 2017 07:26:01 +0000 (08:26 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 20 Jul 2017 17:36:46 +0000 (18:36 +0100)
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 <darren.kenny@oracle.com>
Reviewed-By: Liam Merwick <liam.merwick@oracle.com>
Reviewed-By: Rashmi Narasimhan <rashmi.narasimhan@oracle.com>
Makefile.am
tests/ldoms/dev/mdesc [new file with mode: 0644]
tests/ldoms/proc/cpuinfo [new file with mode: 0644]
tests/test-ldoms.sh [new file with mode: 0755]
virt-what.in
virt-what.pod

index 5cdb943..038a151 100644 (file)
@@ -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 (file)
index 0000000..e69de29
diff --git a/tests/ldoms/proc/cpuinfo b/tests/ldoms/proc/cpuinfo
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/test-ldoms.sh b/tests/test-ldoms.sh
new file mode 100755 (executable)
index 0000000..68c3c77
--- /dev/null
@@ -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
index 1d98eee..f525a89 100644 (file)
@@ -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
index d8b8ba9..78e5655 100644 (file)
@@ -93,6 +93,37 @@ This is a KVM guest running on an IBM System Z hardware system.
 
 Status: contributed by Thomas Huth
 
+=item B<ldoms>
+
+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<ldoms-control>
+
+The is the Oracle VM Server for SPARC (Logical Domains) control domain.
+
+Status: contributed by Darren Kenny
+
+=item B<ldoms-guest>
+
+The is the Oracle VM Server for SPARC (Logical Domains) guest domain.
+
+Status: contributed by Darren Kenny
+
+=item B<ldoms-io>
+
+The is the Oracle VM Server for SPARC (Logical Domains) I/O domain.
+
+Status: contributed by Darren Kenny
+
+=item B<ldoms-root>
+
+The is the Oracle VM Server for SPARC (Logical Domains) Root domain.
+
+Status: contributed by Darren Kenny
+
 =item B<linux_vserver>
 
 This is printed for backwards compatibility with older virt-what which