+def init_list(server, virt, test_disk):
+ lelist = {}
+ status, disk = get_id(server, virt, "LogicalDisk", test_disk)
+ if status != PASS :
+ return status, lelist
+
+ status, mem = get_id(server, virt, "Memory", "mem")
+ if status != PASS :
+ return status, lelist
+
+ status, net = get_id(server, virt, "NetworkPort", test_mac)
+ if status != PASS:
+ return status, lelist
+
+ status, proc = get_id(server, virt, "Processor", "0")
+ if status != PASS:
+ return status, lelist
+
+ lelist = {
+ disk.CreationClassName : disk.DeviceID, \
+ mem.CreationClassName : mem.DeviceID, \
+ net.CreationClassName : net.DeviceID, \
+ proc.CreationClassName : proc.DeviceID
+ }
+ return status, lelist
I'd suggest condensing the 4 get_id() calls into a loop.
In actuality, you don't need to have this function at all. If you know
the 4 values for the reference (CCN, SCCN, DeviceID, and SystemName),
then you don't really need to get the individual device instances at all.
However, I suspect most CIM clients will do similar step, so this is a
reasonable to do in the test.
+
+def eafp_list(server, virt, diskid, d_cap, d_reserve, test_network):
+
I'd remove this function all together.
+
+def verify_eafp_values(server, virt, diskid, test_network, in_pllist):
+ # Looping through the in_pllist to get association for devices.
+ an = get_typed_class(virt, "ElementAllocatedFromPool")
+ sccn = get_typed_class(virt, "ComputerSystem")
+ status, d_cap, d_reserve = eafp_dpool_cap_reserve_val(server, virt,
+ diskid)
+ if status != PASS:
+ return FAIL
+
+ eafp_values = eafp_list(server, virt, diskid, d_cap, d_reserve, test_network)
+ for cn, devid in sorted(in_pllist.items()):
+ try:
+ assoc_info = Associators(server, an, cn,
+ DeviceID = devid,
+ CreationClassName = cn,
+ SystemName = test_dom,
+ SystemCreationClassName = sccn,
+ virt=virt)
+ if len(assoc_info) != 1:
+ logger.error("%s returned %i ResourcePool objects for "
+ "domain '%s'", an, len(assoc_info),
+ test_dom)
+ status = FAIL
+ break
+ assoc_eafp_info = assoc_info[0]
+ CCName = assoc_eafp_info.classname
+ if CCName == eafp_values['procpool']['CCName']:
+ list_values = eafp_values['procpool']
+ status = verify_disk_mem_proc_pool_values(assoc_eafp_info,
+ list_values)
Instead of verifying the values of the host pool returned, I'd determine
which pool instances you expect to see (get the instance values by doing
GetInstance() calls).
Then verify that the pool instance returned by the Associators() call is
the same instance your as the pool instance you got using the
GetInstance() call.
I did something similar for this in the ESD patch I recently sent out.
I'd move these resource pool checks to a resource pool specific test.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com