[Libvirt-cim] [PATCH 1 of 2] [TEST] Fixes to support the ReferencedConfiguration VSMS param

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Jul 22 00:34:00 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1216686405 25200
# Node ID e14f791f1cb4f84ed3cad03c9099d336e232fb48
# Parent  abcd4c8a873656b6f12c4416832d185f8c9eb151
[TEST] Fixes to support the ReferencedConfiguration VSMS param.

These changes are needed to create a test case that tests the ReferencedConfiguration VSMS parameter.

Fixes:
  -Add ref_config param to create_using_definesystem() - allows the caller to specify a reference for the ReferenceConfiguration param
  -Add enumerate_names() - Calls EnumerateInstanceNames() so the caller can get a list of CS references
  -Fix default_vssd_rasd_str() so that is a mac address is supplied to the function, it is used instead of one of the const.<> values.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r abcd4c8a8736 -r e14f791f1cb4 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Mon Jul 21 10:33:31 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Mon Jul 21 17:26:45 2008 -0700
@@ -64,8 +64,8 @@
 
     return (0, cs) 
 
-def create_using_definesystem(domain_name, ip, 
-                              params=None, exp_err=None, virt='Xen'):
+def create_using_definesystem(domain_name, ip, params=None, ref_config=' ', 
+                              exp_err=None, virt='Xen'):
     bug = "85673"
     try:
         class_vsms = eval('vsms.' + \
@@ -89,7 +89,7 @@
 
         service.DefineSystem(SystemSettings=vssd,
                              ResourceSettings=rasd,
-                             ReferenceConfiguration=' ')
+                             ReferenceConfiguration=ref_config)
     except pywbem.CIMError, (rc, desc):
         if rc == exp_rc and desc.find(exp_desc) >= 0:
             logger.info('Got expected rc code and error string.')
diff -r abcd4c8a8736 -r e14f791f1cb4 suites/libvirt-cim/lib/XenKvmLib/computersystem.py
--- a/suites/libvirt-cim/lib/XenKvmLib/computersystem.py	Mon Jul 21 10:33:31 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/computersystem.py	Mon Jul 21 17:26:45 2008 -0700
@@ -95,6 +95,20 @@
 
     return list
 
+def enumerate_names(server, virt='Xen'):
+    conn = pywbem.WBEMConnection('http://%s' % server,
+                                 (Globals.CIM_USER, Globals.CIM_PASS),
+                                 Globals.CIM_NS)
+    classname = get_typed_class(virt, 'ComputerSystem')
+
+    try:
+        refs = conn.EnumerateInstanceNames(classname)
+    except pywbem.CIMError, arg:
+        raise Exception(arg[1])
+        return []
+
+    return refs 
+
 def system_of(server, iname):
     t = eval(iname["CreationClassName"])
 
diff -r abcd4c8a8736 -r e14f791f1cb4 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py	Mon Jul 21 10:33:31 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py	Mon Jul 21 17:26:45 2008 -0700
@@ -263,7 +263,9 @@
         return vssd.mof(), [d.mof(), m.mof()]
     
     class_nasd = get_nasd_class(virt)
-    if virt == 'KVM':
+    if net_mac != const.Xen_default_mac:
+        pass
+    elif virt == 'KVM':
         net_mac= const.KVM_default_mac
     elif virt == 'XenFV':
         net_mac = const.XenFV_default_mac




More information about the Libvirt-cim mailing list