[PATCH] [TEST] Moving the pre_check() fn from main.py to common_util.py

# HG changeset patch # User Deepti B. Kalakeri<deeptik@linux.vnet.ibm.com> # Date 1246342361 25200 # Node ID fe9471d9dd3372b673da5596a18cc49e553b13fa # Parent d67a606da9f7d631368d04280865eb9a21e7ea8a [TEST] Moving the pre_check() fn from main.py to common_util.py Tested with KVM and current sources on F10. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r d67a606da9f7 -r fe9471d9dd33 suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Fri May 29 13:59:02 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Mon Jun 29 23:12:41 2009 -0700 @@ -229,6 +229,41 @@ profiles[key]['InstanceID'] = 'CIM:' + key return profiles +def pre_check(ip, virt): + cmd = "virsh -c %s list --all" % virt2uri(virt) + ret, out = utils.run_remote(ip, cmd) + if ret != 0: + return "This libvirt install does not support %s" % virt + + cmd = "virsh -c %s version" % virt2uri(virt) + ret, out = utils.run_remote(ip, cmd) + if ret != 0: + # The above version cmd does not work for F10. + # Hence, this is a workaround to verify if qemu and qemu-kvm + # are installed in case the above version cmd fails. + cmd = "qemu -help" + ret, out = utils.run_remote(ip, cmd) + if ret != 0: + cmd = "qemu-kvm -help" + ret, out = utils.run_remote(ip, cmd) + if ret != 0: + return "Encountered an error querying for qemu-kvm and qemu " + + cmd = "ps -ef | grep -v grep | grep cimserver" + rc, out = utils.run_remote(ip, cmd) + if rc != 0: + cmd = "ps -ef | grep -v grep | grep sfcbd" + rc, out = utils.run_remote(ip, cmd) + if rc != 0: + return "A supported CIMOM is not running" + + cmd = "ps -ef | grep -v grep | grep libvirtd" + rc, out = utils.run_remote(ip, cmd) + if rc != 0: + return "libvirtd is not running" + + return None + def conf_file(): """ Creating diskpool.conf file. diff -r d67a606da9f7 -r fe9471d9dd33 suites/libvirt-cim/main.py --- a/suites/libvirt-cim/main.py Fri May 29 13:59:02 2009 -0700 +++ b/suites/libvirt-cim/main.py Mon Jun 29 23:12:41 2009 -0700 @@ -39,7 +39,8 @@ from XenKvmLib.xm_virt_util import virt2uri from CimTest.ReturnCodes import PASS, FAIL from XenKvmLib.common_util import create_netpool_conf, destroy_netpool, \ - create_diskpool_conf, destroy_diskpool + create_diskpool_conf, destroy_diskpool, \ + pre_check parser = OptionParser() parser.add_option("-i", "--ip", dest="ip", default="localhost", @@ -92,40 +93,6 @@ print "Cleaned log files." -def pre_check(ip, virt): - cmd = "virsh -c %s list --all" % virt2uri(virt) - ret, out = utils.run_remote(ip, cmd) - if ret != 0: - return "This libvirt install does not support %s" % virt - - cmd = "virsh -c %s version" % virt2uri(virt) - ret, out = utils.run_remote(ip, cmd) - if ret != 0: - # The above version cmd does not work for F10. - # Hence, this is a workaround to verify if qemu and qemu-kvm - # are installed in case the above version cmd fails. - cmd = "qemu -help" - ret, out = utils.run_remote(ip, cmd) - if ret != 0: - cmd = "qemu-kvm -help" - ret, out = utils.run_remote(ip, cmd) - if ret != 0: - return "Encountered an error querying for qemu-kvm and qemu " - - cmd = "ps -ef | grep -v grep | grep cimserver" - rc, out = utils.run_remote(ip, cmd) - if rc != 0: - cmd = "ps -ef | grep -v grep | grep sfcbd" - rc, out = utils.run_remote(ip, cmd) - if rc != 0: - return "A supported CIMOM is not running" - - cmd = "ps -ef | grep -v grep | grep libvirtd" - rc, out = utils.run_remote(ip, cmd) - if rc != 0: - return "libvirtd is not running" - - return None def get_rcfile_vals(): if not os.access(CIMTEST_RCFILE, os.R_OK):
participants (1)
-
Deepti B. Kalakeri