# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1242733506 25200
# Node ID 093bda6ad92c0d6b030cfc1e9d98743335555dff
# Parent 6dc2d815e480237c91115cd0d86f6325503e33f7
[TEST] Modifying get_pool_rasds() of pool.py.
Modifying get_pool_rasds() of pool.py to return all Parent DiskPool and NetworkPool
records when required.
Tested with KVM on F10 with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 6dc2d815e480 -r 093bda6ad92c suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Sun May 17 23:34:58 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Tue May 19 04:45:06 2009 -0700
@@ -105,23 +105,26 @@
return volume
-def get_pool_rasds(server, virt):
+def get_pool_rasds(server, virt, pool_type="NetworkPool",
+ filter_default=True):
net_pool_rasds = []
ac_cn = get_typed_class(virt, "AllocationCapabilities")
an_cn = get_typed_class(virt, "SettingsDefineCapabilities")
- key_list = {"InstanceID" : "NetworkPool/0" }
-
+ key_list = {"InstanceID" : "%s/0" %pool_type }
+
try:
inst = GetInstance(server, ac_cn, key_list)
rasd = Associators(server, an_cn, ac_cn, InstanceID=inst.InstanceID)
except Exception, detail:
logger.error("Exception: %s", detail)
return None
-
- for item in rasd:
- if item['InstanceID'] == "Default":
- net_pool_rasds.append(item)
+ if filter_default == True:
+ for item in rasd:
+ if item['InstanceID'] == "Default":
+ net_pool_rasds.append(item)
+ else:
+ return rasd
return net_pool_rasds
@@ -211,7 +214,7 @@
net_xml = NetXML(server, virt=virt, networkname=poolname,
is_new_net=False)
ret_pool_attr_list = net_xml.xml_get_netpool_attr_list()
-
+
for i in range(0, len(ret_pool_attr_list)):
if ret_pool_attr_list[i] not in pool_attr_list.itervalues():
logger.error("Got error when parsing %s",
ret_pool_attr_list[i])