Re: virt-what patch to support Logical Domains (LDoms) on Linux SPARC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rich,

Richard W.M. Jones wrote:
On Mon, May 15, 2017 at 01:36:43PM +0100, Darren Kenny wrote:
Hi,

I have a patch to add support for Logical Domains (LDoms)
virtualization on SPARC chipsets running Oracle Linux for SPARC.

At the moment Oracle Linux for SPARC is the only variant that
support LDoms, but it is hoped will change in the future.

The virt-what tool seems to be a very useful way to identify the
running virtualization technology, and for anyone that requires it,
we would like to be able to also identify most of the various LDoms
domain types that can be done in a script.

Attached is the patch that provides this support, outputting one or
more of the strings:

     ldoms
     ldoms-control
     ldoms-root
     ldoms-io

I would like to get this applied upstream to the virt-what sources
if that is at all possible.

Hi, sorry I forgot about this until you reminded me just now.

No problem, better late than never ;)
Could you first rebase the patch on top of current git master.

Then I have some comments below ...

diff -u virt-what-1.15/virt-what.in virt-what-1.15-ldoms/virt-what.in
--- virt-what-1.15/virt-what.in	2015-03-27 20:39:40.000000000 +0000
+++ virt-what-1.15-ldoms/virt-what.in	2017-05-08 11:30:36.223265250 +0100
@@ -291,3 +291,22 @@
  if [ -f "${root}/.dockerinit" ]; then
  	echo docker
  fi
+
+#Check for LDoms

Add a space after the # character.

It would be nice to have a test case too, although that's a bit more
work.  It'll ensure that it doesn't regress for any reason in future
since it's unlikely I would ever have a Sparc machine to test this on
for real ...

I've updated the patch and modified it slightly to be able to provide a test-case, I've relaxed the test from a -c to a -f since I can't add a character device in the test tree too easily.

Let me know if you want anything else changed.

Thanks,

Darren.
From f177b8560517fa52cfe0b145ce0649e8a9479da4 Mon Sep 17 00:00:00 2001
From: Darren Kenny <Darren.Kenny@xxxxxxxxxx>
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 <darren.kenny@xxxxxxxxxx>
Reviewed-By: Liam Merwick <liam.merwick@xxxxxxxxxx>
Reviewed-By: Rashmi Narasimhan <rashmi.narasimhan@xxxxxxxxxx>
---
 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<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
-- 
2.9.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux