Merge pull request #688 from asnowfox/master

use /proc/buc/pci/devices to identify a VM is a guest
tags/v2.19.05
shirou 6 years ago committed by GitHub
commit 3d9d5e60ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -566,6 +566,16 @@ func VirtualizationWithContext(ctx context.Context) (string, string, error) {
}
}
filename = common.HostProc("bus/pci/devices")
if common.PathExists(filename) {
contents, err := common.ReadLines(filename)
if err == nil {
if common.StringsContains(contents, "virtio-pci") {
role = "guest"
}
}
}
filename = common.HostProc()
if common.PathExists(filepath.Join(filename, "bc", "0")) {
system = "openvz"

Loading…
Cancel
Save