From ba88128af1ff271b7b3b92e364369fdd034e64f6 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Tue, 21 Jul 2015 15:42:27 +0900 Subject: [PATCH] host_linux: change some virtualization check StringsContains to StringsHas.` --- host/host_linux.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/host/host_linux.go b/host/host_linux.go index a0093c3..7f4db2b 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -328,7 +328,7 @@ func GetVirtualization() (string, string, error) { if common.PathExists("/proc/xen/capabilities") { contents, err := common.ReadLines("/proc/xen/capabilities") if err == nil { - if common.StringsContains(contents, "control_d") { + if common.StringsHas(contents, "control_d") { role = "host" } } @@ -353,9 +353,9 @@ func GetVirtualization() (string, string, error) { if common.PathExists("/proc/cpuinfo") { contents, err := common.ReadLines("/proc/cpuinfo") if err == nil { - if common.StringsContains(contents, "QEMU Virtual CPU") || - common.StringsContains(contents, "Common KVM processor") || - common.StringsContains(contents, "Common 32-bit KVM processor") { + if common.StringsHas(contents, "QEMU Virtual CPU") || + common.StringsHas(contents, "Common KVM processor") || + common.StringsHas(contents, "Common 32-bit KVM processor") { system = "kvm" role = "guest" } @@ -376,8 +376,8 @@ func GetVirtualization() (string, string, error) { contents, err := common.ReadLines("/proc/self/status") if err == nil { - if common.StringsContains(contents, "s_context:") || - common.StringsContains(contents, "VxID:") { + if common.StringsHas(contents, "s_context:") || + common.StringsHas(contents, "VxID:") { system = "linux-vserver" } // TODO: guest or host @@ -387,8 +387,8 @@ func GetVirtualization() (string, string, error) { if common.PathExists("/proc/self/cgroup") { contents, err := common.ReadLines("/proc/self/cgroup") if err == nil { - if common.StringsContains(contents, "lxc") || - common.StringsContains(contents, "docker") { + if common.StringsHas(contents, "lxc") || + common.StringsHas(contents, "docker") { system = "lxc" role = "guest" } else if common.PathExists("/usr/bin/lxc-version") { // TODO: which