
Dan Smith wrote:
ZL> + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, ZL> + mac = test_mac, disk = test_disk)
I'm not familiar with the "function(foo)(bar)" syntax. Can you explain? Yes, just like what Jay explained in the other email.
ZL> + cxml.destroy(options.ip) ZL> + ret = cxml.create(options.ip)
Why destroy it immediately and then create? Does vxml.get_class()() create the domain, or are you trying to make sure it doesn't already exist?
vxml.get_class()(...) only generates the xml string. we need to define & start, or create to make the domain usable. Destroy was here to make sure no such domain alive. I was planned to delete the destroy step because the do_main did this for all test cases. This one was left out. I will remove the destroy step in the updated patch.
ZL> + devlist = [get_typed_class(options.virt, "NetworkPort"), ZL> + get_typed_class(options.virt, "Memory"), ZL> + get_typed_class(options.virt, "LogicalDisk"), ZL> + get_typed_class(options.virt, "Processor")]
Is this used anywhere else but below?
ZL> - if items == "Xen_NetworkPort": ZL> + if items == devlist[0]: ZL> _devid = "%s/%s" % (test_dom, test_mac) ZL> - elif items == "Xen_LogicalDisk": ZL> + elif items == devlist[1]: ZL> + _devid = "%s/mem" % test_dom ZL> + elif items == devlist[2]: ZL> _devid = "%s/%s" % (test_dom, test_disk) ZL> - elif items == "Xen_Processor": ZL> + elif items == devlist[3]: ZL> _devid = "%s/%d" % (test_dom, test_cpu-1) ZL> - elif items == "Xen_Memory": ZL> - _devid = "%s/mem" % test_dom
Going from class names to array values makes this harder to eye-parse.
For the two comments above: I'll make it a dictionary, just like what I did to the other two test cases.
------------------------------------------------------------------------
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- - Zhengang