# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231195386 28800
# Node ID e476bb52a679fd519086a5fbb8310568cb192ddc
# Parent f317d11f46a29a8141563498076d716153dfc5f2
[TEST] Update 35_start_reset.py to work with cim_() functions
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r f317d11f46a2 -r e476bb52a679
suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py Mon Jan 05 14:33:07 2009
-0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py Mon Jan 05 14:43:06 2009
-0800
@@ -29,80 +29,48 @@
# has a value of 2 when the VS is moved from defined to active state and
# and has a value of 11 when reset
#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Active | 2
-# Reset | 11
-#
# Date: 06-03-2008
import sys
-from VirtLib import utils
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.common_util import get_cs_instance, create_using_definesystem, \
- call_request_state_change, \
- poll_for_state_change
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-ACTIVE_STATE = 2
-RESET_STATE = 11
-
default_dom = 'cs_test_domain'
-TIME = "00000000000000.000000:000"
@do_main(sup_types)
def main():
options = main.options
status = FAIL
server = options.ip
- virt = options.virt
-
- tc_scen = [('Start', [ACTIVE_STATE, ACTIVE_STATE]),
- ('Reset', [ACTIVE_STATE, RESET_STATE])]
+ virt = options.virt
try:
# define the vs
- status = create_using_definesystem(default_dom, server,
- virt=virt)
- if status != PASS:
- logger.error("Unable to define domain '%s' using
DefineSystem()",
- default_dom)
- return status
+ cxml = get_class(virt)(default_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
# start and reset
- for action, state in tc_scen:
- en_state = state[0]
- rq_state = state[1]
- status = call_request_state_change(default_dom, server,
- rq_state, TIME,
- virt=virt)
- if status != PASS:
- logger.error("Unable to '%s' dom '%s' using
RequestedStateChange()",
- action, default_dom)
- break
+ status = cxml.cim_start(server)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % default_dom)
- status, dom_cs = poll_for_state_change(server, virt, default_dom, en_state,
- timeout=30)
-
- if status != PASS or dom_cs.RequestedState != rq_state:
- status = FAIL
- logger.error("Attributes for dom '%s' is not set as
expected.",
- default_dom)
- break
-
+ status = cxml.cim_reset(server)
+ if status != PASS:
+ raise Exception("Unable reset dom '%s'" % default_dom)
except Exception, detail:
logger.error("Exception: %s", detail)
status = FAIL
- destroy_and_undefine_domain(default_dom, server, virt)
+ cxml.cim_destroy(server)
+ cxml.undefine(server)
+
return status
if __name__ == "__main__":
diff -r f317d11f46a2 -r e476bb52a679 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Jan 05 14:33:07 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Jan 05 14:43:06 2009 -0800
@@ -614,7 +614,7 @@
def cim_reset(self, server, req_time=const.TIME, poll_time=30):
return self.cim_state_change(server, const.CIM_RESET,
- req_time, poll_time)
+ req_time, poll_time, const.CIM_ENABLE)
class XenXML(VirtXML, VirtCIM):