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

Richard W.M. Jones rjones at redhat.com
Thu May 12 16:21:30 UTC 2022


On Thu, May 12, 2022 at 12:02:46PM -0400, Steve Mokris wrote:
> Thanks for the feedback, Eric and Richard.  In this version, I've expunged the redundant cats and included the Makefile.am.

Thanks - pushed as 763cf1b1123136751b71f475610c5ac1eeaba0ad

Rich.

> ---
>  configure.ac                    |   2 ++
>  tests/illumos-lx/Makefile.am    |  25 +++++++++++++++++++++++++
>  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 ++++++
>  7 files changed, 73 insertions(+)
>  create mode 100644 tests/illumos-lx/Makefile.am
>  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/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 0000000000000000000000000000000000000000..42ec275a5b7959d3d7c36f73bc81a57eba19c23c
> GIT binary patch
> literal 15
> WcmYe!&nrpH%u6k at 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..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<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
> 

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit


More information about the virt-tools-list mailing list