Re: [PATCH 00/14] snapshot: improve dumpxml output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/23/2011 04:34 AM, Eric Blake wrote:
This series fixes 'virsh snapshot-dumpxml' to use nicer formatting.
Patch 1 adds some nice helper routines, patches 2-13 are mostly
mechanical conversions to use the helpers and pass indentation
levels through the entire call chain, and patch 14 adds a test
which uncovered a couple minor issues in how formatting was done.

Hi, I applied these patches and tested it a little bit.
I created a snapshot of a running vm, before applying these patches, snapshot-dumpxml the snapshot output:
<domainsnapshot>
<name>firstshot</name>
<state>running</state>
<creationTime>1316766961</creationTime>
<domain type='kvm'>
<name>lihaidong-redhat0001</name>
<uuid>060673b4-81ab-985d-5203-b76e36946eb4</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch='x86_64' machine='rhel6.1.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source dev='/var/lib/libvirt/images/lihaidong-redhat0001.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address='00:ff:fe:00:00:fb'/>
<source bridge='br0'/>
<target dev='redhat0001'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
</domainsnapshot>

It can be seen that <domain></domain> didn't incident well, it's in the same level with the domainsnapshot. After applying these patches making, restarting the libvirtd, then virsh snapshotdumpxml the snapshot output:
<domainsnapshot>
<name>firstshot</name>
<state>running</state>
<creationTime>1316766961</creationTime>
<domain type='kvm'>
<name>lihaidong-redhat0001</name>
<uuid>060673b4-81ab-985d-5203-b76e36946eb4</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch='x86_64' machine='rhel6.1.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source dev='/var/lib/libvirt/images/lihaidong-redhat0001.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address='00:ff:fe:00:00:fb'/>
<source bridge='br0'/>
<target dev='redhat0001'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
</domainsnapshot>

It can be seen that the <domain></domain> indent correctly.

I typed 'make check' in the tests directory. The domainsnapshotxml2xmltest part output:
TEST: domainsnapshotxml2xmltest
      ......                                   6   OK
PASS: domainsnapshotxml2xmltest

I ran the domainsnapshotxml2xmltest script, it output:
TEST: domainsnapshotxml2xmltest
      ......                                   6   OK

That's what I've done. Thanks.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]