Bug 1347219 - Using "virsh edit" and "virsh dumpxml domain" got different XML file for one VM
Summary: Using "virsh edit" and "virsh dumpxml domain" got different XML file for one VM
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: aarch64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-16 10:23 UTC by Kevin Zhao
Modified: 2016-06-16 12:07 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-16 10:28:53 UTC
Embargoed:


Attachments (Terms of Use)
virsh dumpxml domain1 (3.15 KB, text/plain)
2016-06-16 10:23 UTC, Kevin Zhao
no flags Details
virsh edit domain1 (2.40 KB, text/plain)
2016-06-16 10:24 UTC, Kevin Zhao
no flags Details

Description Kevin Zhao 2016-06-16 10:23:51 UTC
Created attachment 1168664 [details]
virsh dumpxml domain1

Description of problem:
In Aarch64 , after add a virtio disk to a existing VM, reboot to take effect.And then run the virsh dumpxml domain1 and virsh edit domain1 got the different xml file.

Version-Release number of selected component (if applicable):
1.3.1

How reproducible:


Steps to Reproduce:
1. Use virt-manager to create a Fedora23 guest image, use the default setting. After installing, reboot the image. The xml file is in the attachment
2. Using virt-manager to add a virtio disk to this image. The virtio disk is 2GB, bus=virtio, the xml file as below:

[Thu, 16 Jun 2016 08:50:56 virt-manager 18462] DEBUG (domain:1014) attach_device with xml=
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2"/>
  <source file="/var/lib/libvirt/images/f23-1.qcow2"/>
  <target dev="vda" bus="virtio"/>
</disk>

[Thu, 16 Jun 2016 08:50:56 virt-manager 18462] DEBUG (libvirtobject:74) Redefining <vmmDomain name=f23> with XML diff:
--- Original XML
+++ New XML
@@ -54,5 +54,10 @@
     <console type="pty">
       <target type="serial" port="0"/>
     </console>
+    <disk type="file" device="disk">
+      <driver name="qemu" type="qcow2"/>
+      <source file="/var/lib/libvirt/images/f23-1.qcow2"/>
+      <target dev="vda" bus="virtio"/>
+    </disk>
   </devices>
 </domain>

3.Reboot the VM.
4.Enter into the VM, in the /dev, there is no vda device.
5.In the host:
virsh edit domain1 got the edit.xml
virsh dumpxml domain1 got the dumpxml.xml
They in the attachment.

Actual results:
In the edit.xml:
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/f23-1.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='virtio-mmio'/>
    </disk>
In the dumpxml.xml:

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/f23-1.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </disk>
Also , there is no vda in the VM.
Expected results:
Both two xml files are the same, and in VM existing vda device.

Additional info:

Comment 1 Kevin Zhao 2016-06-16 10:24:37 UTC
Created attachment 1168665 [details]
virsh edit domain1

Comment 2 Pavel Hrdina 2016-06-16 10:28:53 UTC
Hi Kevin,

Soft-reboot isn't good enough because it doesn't restart the qemu process and doesn't use new XML.  You need to shutdown and start the VM again in order to load the new XML.

Comment 3 Laine Stump 2016-06-16 12:07:27 UTC
Also note that "virsh dumpxml" and "virsh edit" in general will *not* give the same XML when the guest is running. This is because "virsh dumpxml" provides the current state of the running guest, *not* just the configuration. If you want virsh dumpxml to provide the same output as virsh edit, use this instead:

  virsh dumpxml --inactive $guest

That will provide just the persistent config, without any of the runtime-only things like <alias>.


Note You need to log in before you can comment on or make changes to this bug.