[libvirt] [ISSUE go-xml] go-xml does NOT support DomainDisk marshal

Hi, In the case of disk hot-plug, we need a xml like this : /<disk type="file" device="disk">// // <driver name="qemu" type="qcow2"/>// // <source file="/root/vda.qcow2"/>// // <target dev="vda" bus="virtio"/>// // <address type='pci' domain='0x0000' bus='1' slot='20' function='0x0'/>// //</disk>/ For now, go-xml does not support DomainDisk marshal. Any good idea ?

On Sat, Jun 03, 2017 at 11:27:19AM +0800, ZhenweiPi wrote:
Hi,
In the case of disk hot-plug, we need a xml like this :
/<disk type="file" device="disk">// // <driver name="qemu" type="qcow2"/>// // <source file="/root/vda.qcow2"/>// // <target dev="vda" bus="virtio"/>// // <address type='pci' domain='0x0000' bus='1' slot='20' function='0x0'/>// //</disk>/
For now, go-xml does not support DomainDisk marshal.
Any good idea ?
All we needed todo was add XMLName to the device structs, and define the Marhsal/Unmarhsal methods. The only complication was that we used the same DomainChardev struct for console/serial/channel devices, so I had to define new structs for those. This is all pushed to git now, with tests. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

ONE MILLION THANKS TO YOU! On 06/05/2017 09:05 PM, Daniel P. Berrange wrote:
On Sat, Jun 03, 2017 at 11:27:19AM +0800, ZhenweiPi wrote:
Hi,
In the case of disk hot-plug, we need a xml like this :
/<disk type="file" device="disk">// // <driver name="qemu" type="qcow2"/>// // <source file="/root/vda.qcow2"/>// // <target dev="vda" bus="virtio"/>// // <address type='pci' domain='0x0000' bus='1' slot='20' function='0x0'/>// //</disk>/
For now, go-xml does not support DomainDisk marshal.
Any good idea ? All we needed todo was add XMLName to the device structs, and define the Marhsal/Unmarhsal methods. The only complication was that we used the same DomainChardev struct for console/serial/channel devices, so I had to define new structs for those. This is all pushed to git now, with tests.
Regards, Daniel
participants (2)
-
Daniel P. Berrange
-
ZhenweiPi