# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1222482583 25200
# Node ID 145cde258442f326f9503bc261f9f3674e2fe82d
# Parent 0ecb3a22c3617eaa4298dfd9cd3b7b27b9846110
[TEST]#3 Fix HostedService.02,03&04 to work with sblim base provider installed
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 0ecb3a22c361 -r 145cde258442
suites/libvirt-cim/cimtest/HostedService/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Sep 26 02:44:52 2008
-0700
+++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Fri Sep 26 19:29:43 2008
-0700
@@ -25,6 +25,7 @@ from VirtLib import utils
from VirtLib import utils
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
from CimTest import Globals
from XenKvmLib.const import do_main
@@ -37,11 +38,11 @@ def main():
def main():
options = main.options
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)[0]
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Check sblim provider or enumerate hostsystem error")
return FAIL
+
servicelist = {"ResourcePoolConfigurationService" : "RPCS",
"VirtualSystemManagementService" : "Management
Service",
"VirtualSystemMigrationService" :
"MigrationService"}
@@ -54,8 +55,8 @@ def main():
options.virt,
Name = v,
CreationClassName =
get_typed_class(options.virt, k),
- SystemCreationClassName =
host_sys.CreationClassName,
- SystemName = host_sys.Name)
+ SystemCreationClassName = host_ccn,
+ SystemName = host_name)
except Exception:
logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % item)
return FAIL
@@ -67,10 +68,10 @@ def main():
ccn = assoc_host[0].keybindings['CreationClassName']
name = assoc_host[0].keybindings['Name']
- if ccn != get_typed_class(options.virt, "HostSystem"):
+ if ccn != host_ccn:
logger.error("CreationClassName Error")
return FAIL
- elif name != host_sys.Name:
+ elif name != host_name:
logger.error("CCN Error")
return FAIL
diff -r 0ecb3a22c361 -r 145cde258442
suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 02:44:52 2008
-0700
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Sep 26 19:29:43 2008
-0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -40,24 +41,22 @@ def main():
options = main.options
rc = -1
status = FAIL
- keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
-
+
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"),
- keybindings = {"Wrong" : "wrong",
"CreationClassName" : host_sys.CreationClassName})
+ keybindings = {"Wrong" : "wrong",
\
+ "CreationClassName" : host_ccn})
names = []
-
+ assoc_class = get_typed_class(options.virt, "HostedService")
try:
- names = conn.AssociatorNames(instanceref, AssocClass =
get_typed_class(options.virt, "HostedService"))
+ names = conn.AssociatorNames(instanceref, AssocClass = assoc_class)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
@@ -70,7 +69,8 @@ def main():
logger.error(details)
if rc == 0:
- logger.error("HostedService associator should NOT return excepted result
with a wrong key name and value of HostSystem input")
+ logger.error("HostedService associator should NOT return excepted result\
+ with a wrong key name and value of HostSystem input")
status = FAIL
return status
diff -r 0ecb3a22c361 -r 145cde258442
suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Sep 26 02:44:52 2008
-0700
+++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Sep 26 19:29:43 2008
-0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -40,13 +41,10 @@ def main():
options = main.options
rc = -1
status = FAIL
- keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
servicelist = {get_typed_class(options.virt,
"ResourcePoolConfigurationService") : "RPCS",
get_typed_class(options.virt,
"VirtualSystemManagementService") : "Management Service",
@@ -60,12 +58,12 @@ def main():
instanceref = CIMInstanceName(k,
keybindings = {"Wrong" : v,
"CreationClassName" :
"wrong",
- "SystemCreationClassName"
: host_sys.CreationClassName,
- "SystemName" :
host_sys.Name})
+ "SystemCreationClassName"
: host_name,
+ "SystemName" : host_ccn})
names = []
-
+ assoc_class = get_typed_class(options.virt, "HostedService")
try:
- names = conn.AssociatorNames(instanceref, AssocClass =
get_typed_class(options.virt, "HostedService"))
+ names = conn.AssociatorNames(instanceref, AssocClass = assoc_class)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
@@ -78,7 +76,8 @@ def main():
logger.error(details)
if rc == 0:
- logger.error("HostedService associator should NOT return excepted result
with a wrong key name and value of %s input" % k)
+ logger.error("HostedService associator should NOT return excepted
result\
+ with a wrong key name and value of %s input" % k)
status = FAIL
return status