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

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

 



On 09/26/2011 05:03 PM, Hai Dong Li wrote:
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.

Seems the email mess up the indentation.The attached file dumpxml_old_new_diff shows the differences.
<domainsnapshot>						<domainsnapshot>
  <name>firstshot</name>					  <name>firstshot</name>
  <state>running</state>					  <state>running</state>
  <creationTime>1316766961</creationTime>			  <creationTime>1316766961</creationTime>
  <domain type='kvm'>					      |	<domain type='kvm'>
    <name>lihaidong-redhat0001</name>			      |	  <name>lihaidong-redhat0001</name>
    <uuid>060673b4-81ab-985d-5203-b76e36946eb4</uuid>	      |	  <uuid>060673b4-81ab-985d-5203-b76e36946eb4</uuid>
    <memory>2097152</memory>				      |	  <memory>2097152</memory>
    <currentMemory>2097152</currentMemory>		      |	  <currentMemory>2097152</currentMemory>
    <vcpu>4</vcpu>					      |	  <vcpu>4</vcpu>
    <os>						      |	  <os>
      <type arch='x86_64' machine='rhel6.1.0'>hvm</type>      |	    <type arch='x86_64' machine='rhel6.1.0'>hvm</type>
      <boot dev='hd'/>					      |	    <boot dev='hd'/>
    </os>						      |	  </os>
    <features>						      |	  <features>
      <acpi/>						      |	    <acpi/>
      <apic/>						      |	    <apic/>
      <pae/>						      |	    <pae/>
    </features>						      |	  </features>
    <clock offset='utc'/>				      |	  <clock offset='utc'/>
    <on_poweroff>destroy</on_poweroff>			      |	  <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>			      |	  <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>			      |	  <on_crash>restart</on_crash>
    <devices>						      |	  <devices>
      <emulator>/usr/libexec/qemu-kvm</emulator>	      |	    <emulator>/usr/libexec/qemu-kvm</emulator>
      <disk type='block' device='disk'>			      |	    <disk type='block' device='disk'>
        <driver name='qemu' type='qcow2' cache='none'/>	      |	      <driver name='qemu' type='qcow2' cache='none'/>
        <source dev='/var/lib/libvirt/images/lihaidong-redhat |	      <source dev='/var/lib/libvirt/images/lihaidong-redhat00
        <target dev='vda' bus='virtio'/>		      |	      <target dev='vda' bus='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot=' |	      <address type='pci' domain='0x0000' bus='0x00' slot='0x
      </disk>						      |	    </disk>
      <interface type='bridge'>				      |	    <interface type='bridge'>
        <mac address='00:ff:fe:00:00:fb'/>		      |	      <mac address='00:ff:fe:00:00:fb'/>
        <source bridge='br0'/>				      |	      <source bridge='br0'/>
        <target dev='redhat0001'/>			      |	      <target dev='redhat0001'/>
        <model type='virtio'/>				      |	      <model type='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot=' |	      <address type='pci' domain='0x0000' bus='0x00' slot='0x
      </interface>					      |	    </interface>
      <serial type='pty'>				      |	    <serial type='pty'>
        <target port='0'/>				      |	      <target port='0'/>
      </serial>						      |	    </serial>
      <console type='pty'>				      |	    <console type='pty'>
        <target type='serial' port='0'/>		      |	      <target type='serial' port='0'/>
      </console>					      |	    </console>
      <input type='mouse' bus='ps2'/>			      |	    <input type='mouse' bus='ps2'/>
      <graphics type='vnc' port='-1' autoport='yes' keymap='e |	    <graphics type='vnc' port='-1' autoport='yes' keymap='en-
      <video>						      |	    <video>
        <model type='cirrus' vram='9216' heads='1'/>	      |	      <model type='cirrus' vram='9216' heads='1'/>
        <address type='pci' domain='0x0000' bus='0x00' slot=' |	      <address type='pci' domain='0x0000' bus='0x00' slot='0x
      </video>						      |	    </video>
      <memballoon model='virtio'>			      |	    <memballoon model='virtio'>
        <address type='pci' domain='0x0000' bus='0x00' slot=' |	      <address type='pci' domain='0x0000' bus='0x00' slot='0x
      </memballoon>					      |	    </memballoon>
    </devices>						      |	  </devices>
  </domain>						      |	</domain>
</domainsnapshot>						</domainsnapshot>
--
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]