diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2020-06-29 14:21:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-29 14:21:09 -0400 |
commit | 5d21a9d5427a35a251d64ed372d3d5e16e016474 (patch) | |
tree | 71c1befab4220f04e243a94c0e4f2181df5472e8 /daemon | |
parent | 986b401133b52fada9ec014c9e902660396f6880 (diff) |
Corrected virtualization detection in system-info.sh. (#9425)
This causes failure to detect virtualization to be reported as no
virtualization instead of unknown virtulization.
Diffstat (limited to 'daemon')
-rwxr-xr-x | daemon/system-info.sh | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/daemon/system-info.sh b/daemon/system-info.sh index 884ef6f1a7..0cd24fc4f5 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -23,13 +23,11 @@ if [ -z "${VIRTUALIZATION}" ]; then if grep -q "^flags.*hypervisor" /proc/cpuinfo 2>/dev/null; then VIRTUALIZATION="hypervisor" VIRT_DETECTION="/proc/cpuinfo" - elif [ -n "$(command -v dmidecode)" ]; then - # Virtualization detection from https://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology - # This only works as root - if dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then - VIRTUALIZATION="$(dmidecode -s system-product-name)" - VIRT_DETECTION="dmidecode" - fi + elif [ -n "$(command -v dmidecode)" ] && dmidecode -s system-product-name 2>/dev/null | grep -q "VMware\|Virtual\|KVM\|Bochs"; then + VIRTUALIZATION="$(dmidecode -s system-product-name)" + VIRT_DETECTION="dmidecode" + else + VIRTUALIZATION="none" fi fi else |