[PATCH] [TEST] Add checks for CIMOM and libvirtd

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1219263226 25200 # Node ID 6d3fac9485bc4f4e259d82af1c1fb7c0028b03ae # Parent 1364e9ddf32b315c7e752636b601fa54acd6e44d [TEST] Add checks for CIMOM and libvirtd. Also, clean up some old comments and remove some unneeded white space. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 1364e9ddf32b -r 6d3fac9485bc suites/libvirt-cim/main.py --- a/suites/libvirt-cim/main.py Wed Aug 20 13:13:39 2008 -0700 +++ b/suites/libvirt-cim/main.py Wed Aug 20 13:13:46 2008 -0700 @@ -35,6 +35,7 @@ from XenKvmLib.classes import get_typed_class import ConfigParser from XenKvmLib.reporting import gen_report, send_report +from VirtLib import utils parser = OptionParser() parser.add_option("-i", "--ip", dest="ip", default="localhost", @@ -84,6 +85,22 @@ status, output = commands.getstatusoutput(cmd) print "Cleaned log files." + +def pre_check(ip): + 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): @@ -135,21 +152,22 @@ parser.print_help() return 1 + env_ready = pre_check(options.ip) + if env_ready != None: + print "\n%s. Please check your environment.\n" % env_ready + return 1 + # HACK: Exporting CIMOM_PORT as an env var, to be able to test things - # on Director without having to change a lot of code. - # This will change soon + # with a different port if options.port: os.environ['CIMOM_PORT'] = str(options.port) - # if options.report: + to_addr = options.report from_addr, relay = get_rcfile_vals() - if from_addr == None or relay == None: return 1 - to_addr = options.report - testsuite = TestSuite.TestSuite(log=True) set_python_path()

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1219263226 25200 # Node ID 6d3fac9485bc4f4e259d82af1c1fb7c0028b03ae # Parent 1364e9ddf32b315c7e752636b601fa54acd6e44d [TEST] Add checks for CIMOM and libvirtd.
Also, clean up some old comments and remove some unneeded white space.
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r 1364e9ddf32b -r 6d3fac9485bc suites/libvirt-cim/main.py --- a/suites/libvirt-cim/main.py Wed Aug 20 13:13:39 2008 -0700 +++ b/suites/libvirt-cim/main.py Wed Aug 20 13:13:46 2008 -0700 @@ -35,6 +35,7 @@ from XenKvmLib.classes import get_typed_class import ConfigParser from XenKvmLib.reporting import gen_report, send_report +from VirtLib import utils
parser = OptionParser() parser.add_option("-i", "--ip", dest="ip", default="localhost", @@ -84,6 +85,22 @@ status, output = commands.getstatusoutput(cmd)
print "Cleaned log files." + +def pre_check(ip): + 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): @@ -135,21 +152,22 @@ parser.print_help() return 1
+ env_ready = pre_check(options.ip) + if env_ready != None: + print "\n%s. Please check your environment.\n" % env_ready + return 1 + # HACK: Exporting CIMOM_PORT as an env var, to be able to test
+1 for me. Best, Regards Daisy (运国莲) VSM Team, China Systems & Technology Labs (CSTL) E-mail: yunguol@cn.ibm.com TEL: (86)-21-60922403 Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203 libvirt-cim-bounces@redhat.com wrote on 2008-08-21 04:37:36: things
- # on Director without having to change a lot of code. - # This will change soon + # with a different port if options.port: os.environ['CIMOM_PORT'] = str(options.port) - #
if options.report: + to_addr = options.report from_addr, relay = get_rcfile_vals() - if from_addr == None or relay == None: return 1
- to_addr = options.report - testsuite = TestSuite.TestSuite(log=True)
set_python_path()
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (2)
-
Guo Lian Yun
-
Kaitlin Rupert