[virt-tools-list] FreeBSD support for virt-what

Brad Davis brd at FreeBSD.org
Tue Oct 31 15:04:01 UTC 2017


Hello,

I have patched the virt-what script to work on FreeBSD a bit better.
Please take a look.


Regards,
Brad Davis

root@:~/temp/virt-what-1.18 # diff -u virt-what.orig virt-what
--- virt-what.orig      2017-10-31 07:57:22.752442000 +0000
+++ virt-what   2017-10-31 08:03:40.894197000 +0000
@@ -308,7 +308,7 @@
         # option, since /proc/cpuinfo will not contain the QEMU
         # string. QEMU 2.10 added a new CPUID leaf, so this
         # problem only triggered for older QEMU
-        if grep -q 'QEMU' "${root}/proc/cpuinfo"; then
+        if have_cpuinfo && grep -q 'QEMU' "${root}/proc/cpuinfo"; then
             echo qemu
         fi
     fi
@@ -360,20 +360,20 @@
 fi
 
 # Check for LDoms
-if [[ "$arch" == sparc* && -e ${root}/dev/mdesc ]]; then
+if [ "$arch" = sparc* -a -e ${root}/dev/mdesc ]; then
     echo ldoms
-    if [[ -d ${root}/sys/class/vlds/ctrl && \
-             -d ${root}/sys/class/vlds/sp ]]; then
+    if [ -d ${root}/sys/class/vlds/ctrl -a \
+             -d ${root}/sys/class/vlds/sp ]; then
         echo ldoms-control
     else
         echo ldoms-guest
     fi
     MDPROP="${root}/usr/lib/ldoms/mdprop.py"
-    if [[ -x ${MDPROP} ]]; then
-        if [[ -n $($MDPROP -v iodevice device-type=pciex) ]]; then
+    if [ -x ${MDPROP} ]; then
+        if [ -n $($MDPROP -v iodevice device-type=pciex) ]; then
             echo ldoms-root
             echo ldoms-io
-        elif [[ -n $($MDPROP -v iov-device vf-id=0) ]]; then
+        elif [ -n $($MDPROP -v iov-device vf-id=0) ]; then
             echo ldoms-io
         fi
     fi




More information about the virt-tools-list mailing list