Version 1.7.
[virt-what.git] / virt-what.in
index 0979c50..627f961 100644 (file)
@@ -143,10 +143,19 @@ if echo "$dmi" | grep -q 'Manufacturer.*HITACHI' &&
     echo virtage
 fi
 
-# Check for IBM SystemZ (z/VM, not tested whether this applies to Linux
-# installed directly into an LPAR, we may need a separate test).
+# Check for IBM SystemZ.
 if grep -q '^vendor_id.*IBM/S390' $root/proc/cpuinfo; then
-    echo zvm
+    echo ibm_systemz
+    if [ -f $root/proc/sysinfo ]; then
+        if grep -q 'VM.*Control Program.*z/VM' $root/proc/sysinfo; then
+            echo ibm_systemz-zvm
+        elif grep -q '^LPAR' $root/proc/sysinfo; then
+            echo ibm_systemz-lpar
+        else
+            # This is unlikely to be correct.
+            echo ibm_systemz-direct
+        fi
+    fi
 fi
 
 # Check for Xen.
@@ -162,11 +171,12 @@ elif [ -f $root/proc/xen/capabilities ]; then
         echo xen-domU
     fi
     is_xen=1
-elif [ -d $root/proc/xen ]; then
-    # This directory can be present when Xen paravirt drivers are
-    # installed, even on baremetal.  Don't confuse people by
-    # printing anything.
-    :
+elif [ -f $root/sys/hypervisor/type ] &&
+    grep -q "xen" $root/sys/hypervisor/type; then
+    # Ordinary kernel with pv_ops.  There does not seem to be
+    # enough information at present to tell whether this is dom0
+    # or domU.  XXX
+    echo xen
 fi
 
 # Check for QEMU/KVM.