bug #3722: use both lsmod and sys directory methods to check for kvm

(cherry picked from commit 9b343b02ed)
This commit is contained in:
Javi Fontan committed 2015-03-31 10:31:19 +02:00
1 parent 00764fccf4
commit 36aafcc288
1 file changed
+2 -1
+2 -1
View File
@@ -81,12 +81,13 @@ module VNMMAD
# Return a string for the hypervisor
# @return [String] "kvm", "xen" or nil
def detect_hypervisor
lsmod = `#{VNMNetwork::COMMANDS[:lsmod]}`
xen_file = "/proc/xen/capabilities"
kvm_dir = "/sys/class/misc/kvm"
if File.exists?(xen_file)
"xen"
elsif File.exists?(kvm_dir)
elsif lsmod.match(/kvm/) || File.exists?(kvm_dir)
"kvm"
else
nil