From: Steve Mokris Date: Thu, 12 May 2022 16:02:46 +0000 (-0400) Subject: Detect Illumos (SmartOS/OmniOS) LX virtualization X-Git-Tag: v1.23~1 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=763cf1b1123136751b71f475610c5ac1eeaba0ad;p=virt-what.git Detect Illumos (SmartOS/OmniOS) LX virtualization Thanks for the feedback, Eric and Richard. In this version, I've expunged the redundant cats and included the Makefile.am. --- 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/Makefile.am b/tests/illumos-lx/Makefile.am new file mode 100644 index 0000000..b7f942a --- /dev/null +++ b/tests/illumos-lx/Makefile.am @@ -0,0 +1,25 @@ +# Makefile for virt-what +# 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. + +CLEANFILES = *~ + +TESTS = test.sh + +EXTRA_DIST = \ + test.sh \ + proc/1/environ \ + proc/version diff --git a/tests/illumos-lx/proc/1/environ b/tests/illumos-lx/proc/1/environ new file mode 100644 index 0000000..42ec275 Binary files /dev/null and b/tests/illumos-lx/proc/1/environ differ 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..b59714e 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" ] && + tr '\0' '\n' < "${root}/proc/1/environ" | grep -q '^container=zone$' && + [ -e "${root}/proc/version" ] && + grep -q 'BrandZ virtual linux' < "${root}/proc/version"; 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 + +The guest is running on Illumos with a Linux syscall emulation layer. + +Status: contributed by Steve Mokris + =item B The guest appears to be running on an Linux SPARC system with