Kaitlin Rupert wrote:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1215725330 25200
# Node ID 86285f56abcaf54595bc2cc54c8f044ae37ccbd7
# Parent 0a4bc49a1fbde309070f8cc4c8631cf4a5ad9c68
[TEST] Fix CS 22 to use providers instead of virsh.
This test was defining a guest with virsh and then suspending it with virsh, which
doesn't touch the providers in anyway. Now the test calls DefineSystem() and
RequestStateChange().
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0a4bc49a1fbd -r 86285f56abca
suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Thu Jul 10 12:39:32
2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Thu Jul 10 14:28:50
2008 -0700
@@ -32,54 +32,47 @@
from XenKvmLib import computersystem
from VirtLib import utils
from XenKvmLib import vxml
-from XenKvmLib.test_doms import destroy_and_undefine_all
-from CimTest.Globals import do_main
-from CimTest import Globals
+from XenKvmLib.test_doms import destroy_and_undefine_domain
+from CimTest.Globals import do_main, logger
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import create_using_definesystem, \
+ call_request_state_change
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "domgst"
+SUSPND_STATE = 9
+TIME = "00000000000000.000000:000"
+
@do_main(sup_types)
def main():
options = main.options
- status = FAIL
- cxml = vxml.get_class(options.virt)(test_dom)
-
-#define VS
try:
- ret = cxml.define(options.ip)
- if not ret:
- Globals.logger.error(Globals.VIRSH_ERROR_DEFINE % test_dom)
- return status
-
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
- if not (cs.Name == test_dom) :
- Globals.logger.error("Error: VS %s not found" % test_dom)
- cxml.undefine(options.ip)
+ # define the vs
+ status = create_using_definesystem(test_dom, options.ip,
+ virt=options.virt)
+ if status != PASS:
+ logger.error("Unable to define %s using DefineSystem()" %
test_dom)
return status
- except Exception, detail:
- Globals.logger.error("Errors: %s" % detail)
-
-#Suspend the defined VS
-
- try:
- ret = cxml.run_virsh_cmd(options.ip, "suspend")
- if not ret :
- Globals.logger.info("Suspending defined VS %s failed, as expected"
\
-% test_dom)
+ # suspend the vs
+ status = call_request_state_change(test_dom, options.ip, SUSPND_STATE,
+ TIME, virt=options.virt)
+ if status != PASS:
+ logger.info("Suspending define VS %s failed, as expected" \
+ % test_dom)
status = PASS
Is it just sufficient to check if the status value is set to FAIL by the
call_request_state_change() function, should we not check for "Domain
not running" specifically so that we are sure the tc is flagged as pass
because of no other Exception that might have occured. Thoughts ??
otherwise +1 for me.
else :
- Globals.logger.info("Error: Suspending defined VS %s should not \
-have been allowed" % test_dom)
+ logger.error("Suspending defined VS %s should not have passed" %
\
+ test_dom)
status = FAIL
except Exception, detail:
- Globals.logger.error("Error: %s" % detail)
+ logger.error("Error: %s" % detail)
+ status = FAIL
- ret = cxml.undefine(options.ip)
+ destroy_and_undefine_domain(test_dom, options.ip, options.virt)
return status
if __name__ == "__main__":
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim