@cryptotaxi247 / netdata-1 / commits / 5d21a9d54

Corrected virtualization detection in system-info.sh. (#9425)

This causes failure to detect virtualization to be reported as no virtualization instead of unknown virtulization.

Austin S. Hemmelgarn committed Jun 29, 2020 at 14:21 UTC 5d21a9d5427a35a251d64ed372d3d5e16e016474
1 file changed +5 -7
daemon/system-info.sh
+5 -7
@@ -23,13 +23,11 @@ if [ -z "${VIRTUALIZATION}" ]; then
23 if grep -q "^flags.*hypervisor" /proc/cpuinfo 2>/dev/null; then
24 VIRTUALIZATION="hypervisor"
25 VIRT_DETECTION="/proc/cpuinfo"
26 - elif [ -n "$(command -v dmidecode)" ]; then
27 - # Virtualization detection from https://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
28 - # This only works as root
29 - if dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then
30 - VIRTUALIZATION="$(dmidecode -s system-product-name)"
31 - VIRT_DETECTION="dmidecode"
32 - fi
26 + elif [ -n "$(command -v dmidecode)" ] && dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then
27 + VIRTUALIZATION="$(dmidecode -s system-product-name)"
28 + VIRT_DETECTION="dmidecode"
29 + else
30 + VIRTUALIZATION="none"
31 fi
32 fi
33 else