# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1226705449 28800
# Node ID 0967f6e02888cb791e5a69404bae89dffc332d5c
# Parent 87ae0e86a0e1e3eecf218f11ec079958449a95fc
[TEST] Have Assocatiors() / AssciatorNames() set proper namespace
If the prefix of the class is Linux_, use root/cimv2 as the namespace.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 87ae0e86a0e1 -r 0967f6e02888 suites/libvirt-cim/lib/XenKvmLib/assoc.py
--- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Nov 14 15:30:48 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Fri Nov 14 15:30:49 2008 -0800
@@ -26,7 +26,7 @@
from VirtLib import utils
import pywbem
from pywbem.cim_obj import CIMInstanceName
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_typed_class, get_class_type
from CimTest.ReturnCodes import PASS, FAIL
from CimTest.Globals import logger
@@ -36,6 +36,10 @@
Return a list of CIMInstanceName objects, if an valid
@keys is provided, or CIMClassName objects, if no
@keys is provided, or None on failure'''
+
+ if (get_class_type(classname) == "Linux"):
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/cimv2'
conn = myWBEMConnection('http://%s' % host,
(Globals.CIM_USER, Globals.CIM_PASS),
@@ -51,6 +55,9 @@
print arg[1]
return names
+ if (get_class_type(classname) == "Linux"):
+ Globals.CIM_NS = prev_namespace
+
return names
def Associators(host, assoc_cn, classname, **keys):
@@ -59,6 +66,10 @@
Return a list of CIMInstanceName objects, if an valid
@keys is provided, or CIMClassName objects, if no
@keys is provided, or None on failure'''
+
+ if (get_class_type(classname) == "Linux"):
+ prev_namespace = Globals.CIM_NS
+ Globals.CIM_NS = 'root/cimv2'
conn = myWBEMConnection('http://%s' % host,
(Globals.CIM_USER, Globals.CIM_PASS),
@@ -72,6 +83,9 @@
names = conn.Associators(instanceref, AssocClass=assoc_cn)
except pywbem.CIMError, arg:
print arg[1]
+
+ if (get_class_type(classname) == "Linux"):
+ Globals.CIM_NS = prev_namespace
return names