On 08/30/2012 10:59 PM, Tang Chen wrote:
Hi Chris,
Referred to your comments for net_create tests, I think we can
do the job like following.
1. Construct the class inherit tree like the following.
LibvirtXML(XMLTreeFile)
|
|------VMXML(LibvirtXML)
| |
| |------VMInterfaceXML(VMXML)
| |------VMDiskXML(VMXML)
| |------VMControllerXML(VMXML)
| |------......
|
|------NetworkXML(LibvirtXML)
|
|------StorageXML(LibvirtXML)
|
|------......
2. Make VMXML object as a member of class VM in libvirt_vm.py.
1) Remove all xml related function in class VM.
2) Initialize VMXML object with dumpxml command when VM object
is initialized.
3) Modify all functions like vm.attach-interface() to update
VMXML object when they modifise the vm's configuration.
How do you think about this?
I will raise an issue on github for this topic.
Thinks. :)
Thanks for sharing your ideas. I appreciate your origination and
thinking ahead here. Thanks for opening up the issue as well!
In my experience class-structure (inheritance) doesn't follow
container-like usage well. Instead it's better to think of inheritance
as 'is a kind of ...'. I'm open if we want to use LibvirtXML as a
base-class, or use it to objectify things (literally) from libvirtd in
general (like virsh capabilities XML).
Though I like your idea for the other classes (VMInterface, VMDisk,
etc.) Let's go with that, but keep the class structure relatively flat.
That doesn't preclude any of these classes containing one another, it
just keeps the 'is a kind of ...' more general.
For example:
LibvirtXMLBase(XMLTreeFile)
|
|
+---LibvirtXML(LibvirtXMLBase)
|
|
+---VMXML(LibvirtXMLBase)
|
|
+---VMInterfaceXML(LibvirtXMLBase)
|
+--- ...
--
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel