+def pool_init_list(virt, pool_assoc, net_name, dp_InstID):
"""
Creating the lists that will be used for comparisons.
"""
in_pllist = {}
- for i in range(len(pool_assoc)):
- classname_keyvalue = pool_assoc[i].classname
- instid = pool_assoc[i]['InstanceID']
- in_pllist[classname_keyvalue] = instid
+ mpool = get_typed_class(virt, 'MemoryPool')
+
+ exp_pllist = {
+ mpool : 'MemoryPool/0'
+ }
+
+ if virt != 'LXC':
+ npool = get_typed_class(virt, 'NetworkPool')
+ dpool = get_typed_class(virt, 'DiskPool')
+ ppool = get_typed_class(virt, 'ProcessorPool')
+ exp_pllist[dpool] = dp_InstID
+ exp_pllist[npool] = '%s/%s' %('NetworkPool', net_name)
+ exp_pllist[ppool] = 'ProcessorPool/0'
+ exp_pllist[mpool] = 'MemoryPool/0'
+
+ for p_inst in pool_assoc:
+ CName = p_inst.classname
+ InstID = p_inst['InstanceID']
+ if exp_pllist[CName] == InstID:
+ in_pllist[CName] = InstID
+
return in_pllist
Thanks Deepti - I think this is much easier to read. And good point
about HostedResourcePool nor returning all of the expected pool instances.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com