[libvirt] [PATCH v2] virsh: Remove <backingStore> when changing cdrom media source

Ján Tomko jtomko at redhat.com
Thu Feb 18 08:57:16 UTC 2016


On Wed, Feb 10, 2016 at 09:17:45AM +0100, Peter Krempa wrote:
> 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>
> ---
> 
> Notes:
>     v2:
>     - adapted to new version of code
>     - fixed use after free from previous version
>     - added more text to commit message
> 
>  tools/virsh-domain.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 

ack

jan




More information about the libvir-list mailing list