This is an automatically generated e-mail. To reply, visit: http://reviewboard-openlmi.rhcloud.com/r/893/

Ship it!

Ship It!

cli/lmi/shell/LMIUtil.py (Diff revision 2)
362
    del instances
is it needed? since it seems local like the ref_list which is not requested to be deleted, just overwritten.

- Ales Ledvinka


On September 27th, 2013, 11:12 a.m. UTC, Peter Hatina wrote:

Review request for OpenLMI Developers.
By Peter Hatina.

Updated Sept. 27, 2013, 11:12 a.m.

Repository: openlmi-tools

Description

This patch introduces lmi_associators() function, which should speed up associations traversal by pulling all the instances referenced by association class.

Testing

Example of usage:

c = connect(...)

assoc_class_list = [
    c.root.cimv2.CIM_BasedOn,
    c.root.cimv2.LMI_PhysicalMemoryContainer,
    c.root.cimv2.LMI_SystemStorageDevice,
]

for tpl in lmi_associators(assoc_class_list):
   print " <-> ".join([get_instance_id(x) for x in tpl])

Output:

/dev/disk/by-uuid/fc6b795d-8722-4222-9252-3cfb3b704dd3 <-> /dev/vda
/dev/disk/by-uuid/09331a46-7876-46de-b9f9-496fc3ff5870 <-> /dev/vda
/dev/disk/by-id/dm-name-volgroup1-lvol0 <-> /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005
/dev/disk/by-id/dm-name-volgroup1-lvol0 <-> /dev/disk/by-id/ata-QEMU_HARDDISK_QM00007
LMI:LMI_MemoryPhysicalPackage:0 <-> LMI:LMI_PhysicalMemory:0
rawhide <-> /dev/disk/by-id/ata-QEMU_HARDDISK_QM00005
rawhide <-> /dev/disk/by-id/ata-QEMU_HARDDISK_QM00007
rawhide <-> /dev/vda
rawhide <-> /dev/disk/by-uuid/fc6b795d-8722-4222-9252-3cfb3b704dd3
rawhide <-> /dev/disk/by-uuid/09331a46-7876-46de-b9f9-496fc3ff5870
rawhide <-> /dev/disk/by-id/dm-name-volgroup1-lvol0

NOTE: Function get_instance_id() is local helper function, which returns key property of a class.

Diffs

  • cli/lmi/shell/LMIConsole.py (bebcce353c9547a9d7ed1c5f0031319e1876b29a)
  • cli/lmi/shell/LMIUtil.py (94f38b4ffedc286e3ac407085b66ad278ed1bcda)

View Diff