[Libvirt-cim] [PATCH] [TEST] #2 Add new test to verify enum of DiskRASD to have EmulatedType=0 for Disk
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Mon Dec 22 19:59:43 UTC 2008
> +
> + drasd= get_typed_class(options.virt, 'DiskResourceAllocationSettingData')
> + try:
> + drasd_list = enumclass.EnumInstances(options.ip, drasd, ret_cim_inst=True)
> + if len(drasd_list) < 1:
> + logger.error("%s returned %i instances, excepted at least 1.",
> + drasd, len(drasd_list))
> + return FAIL
> + except Exception, detail:
> + logger.error(CIM_ERROR_ENUMERATE, drasd)
> + logger.error("Exception: %s", detail)
> + return FAIL
> +
> + for rasd in drasd_list:
> + guest, dev, status = parse_instance_id(rasd['InstanceID'])
> + if status != PASS:
> + logger.error("Unable to parse InstanceID: %s" % rasd['InstanceID'])
> + return FAIL
> +
> + if guest == default_dom:
> + if rasd['EmulatedType'] == exp_emu_type:
> + status = PASS
> + else:
> + logger.error("EmulatedType Mismatch: got %d, expected \
> + %d", rasd['EmulatedType'], exp_emu_type)
> + return FAIL
Once you find a match, you should break from the for loop. Also, you
want to return an error if none of the DiskRASDs are for the guest
you're looking for.
> +
> +
> + undefine_test_domain(default_dom, options.ip,
> + virt=options.virt)\
This should be cxml.undefine().
> +
> + return status
You can use this testcase to test both EmulatedType = 1 and EmulatedType
= 0.
1) Create a list that is emu_types = [0, 1]
2) for exp_emu_type in emu_types:
3) Define guest
4) Enum DiskRASDs
5) Get DiskRASD for guest
6) Verify EmulationType
7) Undefine guest
That way you can test both values in one test.
> +
> +if __name__ == "__main__":
> + sys.exit(main())
> diff -r e1783c9fa63c -r 8be7de405963 suites/libvirt-cim/lib/XenKvmLib/common_util.py
> --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Thu Dec 18 14:35:14 2008 -0800
> +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Sun Dec 21 22:43:59 2008 -0800
> @@ -72,7 +72,7 @@
> return (0, cs)
>
> def create_using_definesystem(domain_name, ip, params=None, ref_config=' ',
> - exp_err=None, virt='Xen'):
> + exp_err=None, emu_type=None, virt='Xen'):
You aren't using create_using_definesystem(), so no need to update it.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list