|
|
|
@ -359,7 +359,7 @@ func Virtualization() (string, string, error) {
|
|
|
|
|
if common.PathExists(filename + "/capabilities") {
|
|
|
|
|
contents, err := common.ReadLines(filename + "/capabilities")
|
|
|
|
|
if err == nil {
|
|
|
|
|
if common.StringsHas(contents, "control_d") {
|
|
|
|
|
if common.StringsContains(contents, "control_d") {
|
|
|
|
|
role = "host"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -387,9 +387,9 @@ func Virtualization() (string, string, error) {
|
|
|
|
|
if common.PathExists(filename) {
|
|
|
|
|
contents, err := common.ReadLines(filename)
|
|
|
|
|
if err == nil {
|
|
|
|
|
if common.StringsHas(contents, "QEMU Virtual CPU") ||
|
|
|
|
|
common.StringsHas(contents, "Common KVM processor") ||
|
|
|
|
|
common.StringsHas(contents, "Common 32-bit KVM processor") {
|
|
|
|
|
if common.StringsContains(contents, "QEMU Virtual CPU") ||
|
|
|
|
|
common.StringsContains(contents, "Common KVM processor") ||
|
|
|
|
|
common.StringsContains(contents, "Common 32-bit KVM processor") {
|
|
|
|
|
system = "kvm"
|
|
|
|
|
role = "guest"
|
|
|
|
|
}
|
|
|
|
@ -410,8 +410,8 @@ func Virtualization() (string, string, error) {
|
|
|
|
|
contents, err := common.ReadLines(filename + "/self/status")
|
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
|
|
if common.StringsHas(contents, "s_context:") ||
|
|
|
|
|
common.StringsHas(contents, "VxID:") {
|
|
|
|
|
if common.StringsContains(contents, "s_context:") ||
|
|
|
|
|
common.StringsContains(contents, "VxID:") {
|
|
|
|
|
system = "linux-vserver"
|
|
|
|
|
}
|
|
|
|
|
// TODO: guest or host
|
|
|
|
@ -421,11 +421,16 @@ func Virtualization() (string, string, error) {
|
|
|
|
|
if common.PathExists(filename + "/self/cgroup") {
|
|
|
|
|
contents, err := common.ReadLines(filename + "/self/cgroup")
|
|
|
|
|
if err == nil {
|
|
|
|
|
if common.StringsHas(contents, "lxc") ||
|
|
|
|
|
common.StringsHas(contents, "docker") {
|
|
|
|
|
if common.StringsContains(contents, "lxc") {
|
|
|
|
|
system = "lxc"
|
|
|
|
|
role = "guest"
|
|
|
|
|
} else if common.PathExists("/usr/bin/lxc-version") { // TODO: which
|
|
|
|
|
} else if common.StringsContains(contents, "docker") {
|
|
|
|
|
system = "docker"
|
|
|
|
|
role = "guest"
|
|
|
|
|
} else if common.StringsContains(contents, "machine-rkt") {
|
|
|
|
|
system = "rkt"
|
|
|
|
|
role = "guest"
|
|
|
|
|
} else if common.PathExists("/usr/bin/lxc-version") {
|
|
|
|
|
system = "lxc"
|
|
|
|
|
role = "host"
|
|
|
|
|
}
|
|
|
|
|