# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1217542648 25200
# Node ID b53b5a20e8f561366ff90f2156ad6d26d90b5d1b
# Parent d0c5bdff331b674690f973a70d4ef00878e484f4
Update ElementConforms 02 to use check_virsh_poll() work around.
Also clean this test case some.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r d0c5bdff331b -r b53b5a20e8f5
suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py Thu Jul 31 15:17:18 2008
-0700
+++ b/suites/libvirt-cim/cimtest/ElementConforms/02_reverse.py Thu Jul 31 15:17:28 2008
-0700
@@ -52,6 +52,7 @@
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from XenKvmLib.classes import get_typed_class
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import check_virsh_poll, get_cs_instance
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
@@ -96,51 +97,41 @@
inst_list = []
+ rc, cs = get_cs_instance(test_dom, options.ip, options.virt)
+ if rc != 0:
+ sys = check_virsh_poll(options.ip, options.virt, test_dom)
+ if sys is None:
+ logger.error("Instance for %s not created" % test_dom)
+ return FAIL
+
+ inst_list.append(sys)
+
try:
- cs_list = computersystem.enumerate(options.ip, options.virt)
- # The len should be atleast two, as the CS returns info
- # one regarding VS and the other one for Domain-0.
- if len(cs_list) < 1:
- logger.error("ERROR: Wrong number of instances returned")
- return status
- for item in cs_list:
- if item.Name == test_dom:
- inst_list.append(item)
- break
-
- if len(inst_list) != 1:
- logger.error("ERROR: Instance for %s not created" % test_dom)
- return status
-
#Getting the hostname, to verify with the value returned by the assoc.
host_sys = hostsystem.enumerate(options.ip, options.virt)
if len(host_sys) < 1:
logger.error("ERROR: Enumerate returned 0 host instances")
- return status
- elif host_sys[0].Name == "":
- logger.error("ERROR: HostName seems to be empty")
- return status
- else:
- # Instance of the HostSystem
- inst_list.append(host_sys[0])
- except Exception , detail:
- logger.error("Exception: %s" % detail)
- return status
+ return FAIL
+
+ inst_list.append(host_sys[0])
+
+ except Exception, details:
+ logger.error("Exception: %s" % details)
+ return FAIL
prev_namespace = Globals.CIM_NS
Globals.CIM_NS = 'root/interop'
try:
key_list = ["InstanceID"]
- proflist = enumclass.enumerate(options.ip, \
- "RegisteredProfile", \
+ proflist = enumclass.enumerate(options.ip,
+ "RegisteredProfile",
key_list,
options.virt)
- except Exception, detail:
- logger.error(CIM_ERROR_ENUMERATE, \
- 'RegisteredProfile')
- logger.error("Exception: %s", detail)
+ except Exception, details:
+ logger.error(CIM_ERROR_ENUMERATE, 'RegisteredProfile')
+ logger.error("Exception: %s", details)
return status
Globals.CIM_NS = prev_namespace
@@ -160,11 +151,12 @@
Name=name)
if len(profs) != 1:
logger.error("ElementConformsToProfile assoc failed")
- return status
+ return FAIL
status = verify_profile(profs[0], exp_list[cn])
if status != PASS:
logger.error("Verification of profile instance failed")
+ return FAIL
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, 'RegisteredProfile')