Re: [PATCH] Detect Illumos (SmartOS/OmniOS) LX virtualization

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

 



Here's a revised version of my previous patch, based on discussion at https://github.com/TritonDataCenter/illumos-joyent/pull/415 .

---
 configure.ac                    |   2 ++
 tests/illumos-lx/proc/1/environ | Bin 0 -> 15 bytes
 tests/illumos-lx/proc/version   |   1 +
 tests/illumos-lx/test.sh        |  32 ++++++++++++++++++++++++++++++++
 virt-what.in                    |   7 +++++++
 virt-what.pod                   |   6 ++++++
 6 files changed, 48 insertions(+)
 create mode 100644 tests/illumos-lx/proc/1/environ
 create mode 100644 tests/illumos-lx/proc/version
 create mode 100755 tests/illumos-lx/test.sh

diff --git a/configure.ac b/configure.ac
index ad481fc..88b3c64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ tests="\
 	esx-arm \
 	esx4.1 \
 	hyperv \
+	illumos-lx \
 	kvm \
 	kvm-explicit-cpu \
 	ldoms \
@@ -91,6 +92,7 @@ AC_CONFIG_FILES([Makefile
 	         tests/esx-arm/Makefile
 	         tests/esx4.1/Makefile
 	         tests/hyperv/Makefile
+	         tests/illumos-lx/Makefile
 	         tests/kvm/Makefile
 	         tests/kvm-explicit-cpu/Makefile
 	         tests/ldoms/Makefile
diff --git a/tests/illumos-lx/proc/1/environ b/tests/illumos-lx/proc/1/environ
new file mode 100644
index 0000000000000000000000000000000000000000..42ec275a5b7959d3d7c36f73bc81a57eba19c23c
GIT binary patch
literal 15
WcmYe!&nrpH%u6k@t;)|!WdHy${RO=M

literal 0
HcmV?d00001

diff --git a/tests/illumos-lx/proc/version b/tests/illumos-lx/proc/version
new file mode 100644
index 0000000..986628f
--- /dev/null
+++ b/tests/illumos-lx/proc/version
@@ -0,0 +1 @@
+Linux version 3.16.0 (gcc version 7.5.0) BrandZ virtual linux
diff --git a/tests/illumos-lx/test.sh b/tests/illumos-lx/test.sh
new file mode 100755
index 0000000..84f0900
--- /dev/null
+++ b/tests/illumos-lx/test.sh
@@ -0,0 +1,32 @@
+# Test for illumos-lx
+# Copyright (C) 2022 Steve Mokris
+#
+# 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.
+
+output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
+expected="illumos-lx"
+
+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 d56c84f..ef594d9 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -179,6 +179,13 @@ if [ -e "${root}/proc/1/environ" ] &&
     echo lxc
 fi
 
+if [ -e "${root}/proc/1/environ" ] &&
+    cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -q '^container=zone$' &&
+    [ -e "${root}/proc/version" ] &&
+    cat "${root}/proc/version" | grep -q 'BrandZ virtual linux'; then
+    echo illumos-lx
+fi
+
 # Check for Linux-VServer
 if test -e "${root}/proc/self/status" \
    && cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then
diff --git a/virt-what.pod b/virt-what.pod
index 2bce5c8..ec44ee9 100644
--- a/virt-what.pod
+++ b/virt-what.pod
@@ -117,6 +117,12 @@ This is a KVM guest running on an IBM System Z hardware system.
 
 Status: contributed by Thomas Huth
 
+=item B<illumos-lx>
+
+The guest is running on Illumos with a Linux syscall emulation layer.
+
+Status: contributed by Steve Mokris
+
 =item B<ldoms>
 
 The guest appears to be running on an Linux SPARC system with
-- 
2.31.1






[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