# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1207881544 -28800
# Node ID fd2df63589968f4a14891f6c23c2748918b9b68f
# Parent 70565a27044e9d1f1219230bf1a5f7de6240e6ab
[TEST] set default kvm emulator based on cpu capabilities
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 70565a27044e -r fd2df6358996 lib/VirtLib/live.py
--- a/lib/VirtLib/live.py Thu Apr 10 15:11:06 2008 +0800
+++ b/lib/VirtLib/live.py Fri Apr 11 10:39:04 2008 +0800
@@ -237,13 +237,7 @@ def bootloader(server, gtype = 0):
or domUloader.py for SLES.
3) returns the bootloader.
"""
- cmd = "cat /proc/cpuinfo | egrep flags | uniq | egrep 'vmx|svm' "
- ret, out = utils.run_remote(server,cmd)
- if ret != 0:
- mtype = "PVT"
- else:
- mtype = "FVT"
- if mtype == "FVT" and gtype == 1:
+ if fv_cap(server) and gtype == 1:
bootloader = "/usr/lib/xen/boot/hvmloader"
else:
cmd = "cat /etc/issue | grep -v ^$ | egrep 'Red Hat|Fedora'"
@@ -256,6 +250,11 @@ def bootloader(server, gtype = 0):
bootloader = "/usr/bin/pygrub"
return bootloader
+def fv_cap(server):
+ cmd = "egrep flags /proc/cpuinfo | uniq | egrep 'vmx|svm'"
+ ret, out = utils.run_remote(server, cmd)
+ return ret == 0
+
def hostname(server):
"""To return the hostname of the cimserver"""
diff -r 70565a27044e -r fd2df6358996 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Thu Apr 10 15:11:06 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Fri Apr 11 10:39:04 2008 +0800
@@ -20,6 +20,8 @@
import os
import platform
+from VirtLib.live import fv_cap
+from CimTest.Globals import CIM_IP
# vxml.NetXML
default_bridge_name = 'testbridge'
@@ -43,7 +45,10 @@ Xen_default_net_type = 'ethernet'
Xen_default_net_type = 'ethernet'
# vxml.KVMXML
-KVM_default_emulator = '/usr/bin/qemu-kvm'
+if fv_cap(CIM_IP):
+ KVM_default_emulator = '/usr/bin/qemu-kvm'
+else:
+ KVM_default_emulator = '/usr/bin/qemu'
KVM_disk_path = os.path.join(_image_dir, 'default-kvm-dimage')
KVM_secondary_disk_path = os.path.join(_image_dir, 'default-kvm-dimage.2ND')
KVM_default_disk_dev = 'hda'