]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Remove <backingStore> when changing cdrom media source
authorPeter Krempa <pkrempa@redhat.com>
Tue, 28 Jul 2015 13:34:58 +0000 (15:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 Feb 2016 08:50:45 +0000 (09:50 +0100)
commit3ad5186ed3a511b53cd55c36feff8b2f98df61e7
tree942d9aeeeeb1fe4fbeb4b0d0e1fbca0f54f6445d
parent71eb431c63359452ba310a1aff76244afbc53784
virsh: Remove <backingStore> when changing cdrom media source

Since the code is changing the source image path by modifying the
existing XML snippet the <backingStore> stays in place.

As <backingStore> is relevant to the <source> part of the image, the
update of that part makes the element invalid.

CD/floppy images usually don't have a backing chain and the element is
currently ignored though but it might start being used in the future so
let's start behaving correctly.

Drop the <backingStore> subtree once we want to update the XML.

Before this patch, you'd get:
$ virsh change-media --eject --print-xml 10 hdc
<disk type="file" device="cdrom">
      <driver name="qemu" type="qcow2"/>

      <backingStore type="file" index="1">
        <format type="qcow2"/>
        <source file="/var/lib/libvirt/images/vm.1436949097"/>
        <backingStore/>
      </backingStore>
      <target dev="hdc" bus="ide"/>
      ...
    </disk>

After:

 $ virsh change-media --eject --print-xml 10 hdc
<disk type="file" device="cdrom">
      <driver name="qemu" type="qcow2"/>

      <target dev="hdc" bus="ide"/>
      ...
    </disk>
tools/virsh-domain.c