[Libvirt-cim] [PATCH] [TEST] Get the proper default net template RASD

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Sat Dec 12 01:17:24 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1260576721 28800
# Node ID 7635e4deb3516ffe938ee597bd5e771cd7fae491
# Parent  4c73bb18cd2d6144debd06135ad8de6e569f6747
[TEST] Get the proper default net template RASD

The test caes assume "network" for the default interface type.  Depending on
how the templates are returned, SettingsDefineCapabilities might return a
"bridge" or "user" type interface.  This fix adds some additional filtering
to get the proper template.


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

diff -r 4c73bb18cd2d -r 7635e4deb351 suites/libvirt-cim/lib/XenKvmLib/rasd.py
--- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py	Fri Dec 11 16:12:01 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py	Fri Dec 11 16:12:01 2009 -0800
@@ -29,7 +29,7 @@
 from XenKvmLib.enumclass import GetInstance, EnumInstances
 from XenKvmLib.assoc import Associators 
 from XenKvmLib.const import default_pool_name, default_network_name, \
-                            get_provider_version
+                            get_provider_version, default_net_type
 from XenKvmLib.pool import enum_volumes
 from XenKvmLib.xm_virt_util import virsh_version
 from XenKvmLib.common_util import parse_instance_id
@@ -251,6 +251,8 @@
             ac_id_list.append("NetworkPool/%s" % default_network_name)
             ac_id_list.append("ProcessorPool/0")
 
+    net_cn = "NetResourceAllocationSettingData"
+
     templates = [] 
     
     for id in ac_id_list:
@@ -260,7 +262,10 @@
             return []
 
         for rasd in rasd_list:
-            if rasd['InstanceID'] == "Default": 
+            if rasd['InstanceID'] == "Default":
+                if rasd.classname.find(net_cn) > 0 and \
+                   rasd['NetworkType'] != default_net_type:
+                    continue
                 templates.append(rasd)
 
     return templates




More information about the Libvirt-cim mailing list