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

Eric Blake eblake at redhat.com
Thu May 12 14:23:13 UTC 2022


On Wed, May 11, 2022 at 11:28:56AM -0400, Steve Mokris wrote:
> Here's a revised version of my previous patch, based on discussion at https://github.com/TritonDataCenter/illumos-joyent/pull/415 .
> 
> ---

> +++ 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$' &&

Useless use of cat; this could be:

  tr '\0' '\n' < "${root}/proc/1/environ" | grep -q '^container=zone$' &&

> +    [ -e "${root}/proc/version" ] &&
> +    cat "${root}/proc/version" | grep -q 'BrandZ virtual linux'; then

and similarly,

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

But as it is a pre-existing pattern in this file, we could do it as a
separate cleanup.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


More information about the virt-tools-list mailing list