[Libvirt-cim] [PATCH 2 of 3] [TEST] add ElementAllocatedFromPool.01 for KVM & XenFV support
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Wed Apr 16 21:09:54 UTC 2008
> diff -r dfe0e517e990 -r ac6d65d178a0
suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py
This test doesn't pass for me with KVM on F9 using recent providers. I
get the following error:
CIM_ERR_FAILED: Unknown pool membership for `hd_domain/hda'
I think the issue here is that the guest's devices belong to an
appropriate disk pool. You'll need to create a function similar to the
network_pool function that ensures the guest's device belongs to the
expected pool.
Also, it's a good idea to have a negative case that makes sure you get
this kind of error when the guest's device doesn't belong to a pool.
> -def get_keys(cn, device_id):
> +def get_keys(cn, device_id, virt='Xen'):
> id = "%s/%s" % (test_dom, device_id)
>
> key_list = { 'DeviceID' : id,
> 'CreationClassName' : cn,
> 'SystemName' : test_dom,
> - 'SystemCreationClassName' : "Xen_ComputerSystem"
> + 'SystemCreationClassName' : get_typed_class(virt, "ComputerSystem")
This line spans 80 characters. You could declare a classname variable
above and then use classname here.
> - try:
> - cn = "Xen_Memory"
> - key_list = get_keys(cn, "mem")
> - mem = devices.Xen_Memory(options.ip, key_list)
> + logger.error('Unable to create domain %s' % test_dom)
> + return FAIL
> +
> + try:
> + cn = get_typed_class(options.virt, "LogicalDisk")
> + key_list = get_keys(cn, test_disk, options.virt)
> + disk = eval('devices.' + get_typed_class(options.virt, "LogicalDisk"))(options.ip, key_list)
This is long and is tough to read. I'd use a variable for the
get_typed_class(options.virt, "LogicalDisk") so that it's clear that
this line should be something like:
devices.KVM_LogicalDisk
devices.Xen_LogicalDisk
The same goes for the all devices in this test.
> if len(assoc_info) != 1:
> - Globals.logger.error("Xen_ElementAllocatedFromPool returned %i\
> - ResourcePool objects for domain '%s'", len(assoc_info), test_dom)
> + Globals.logger.error("ElementAllocatedFromPool returned %i\
> + ResourcePool objects for domain '%s'", len(assoc_info), test_dom)
This line is long - the string arguments can go on a separate line.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list