Red Hat Bugzilla – Bug 1328301
update floppy device with readonly element report cannot modify snapshot error
Last modified: 2016-11-03 14:43:05 EDT
Description of problem: update floppy device with readonly element report cannot modify snapshot error Version-Release number of selected component (if applicable): libvirt-1.3.3-2.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. define and start guest with a floppy device. # virsh dumpxml r72|grep disk -A 9 <disk type='file' device='floppy'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/fd.img'/> <backingStore/> <target dev='fda' bus='fdc'/> <alias name='fdc0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 2. update floppy device with "readonly". # cat update-floppy.xml <disk type='file' device='floppy'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/fd.img'/> ===> no matter I change the source or not here. <target dev='fda' bus='fdc'/> <readonly/> ===> additional readonly <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> # virsh update-device r72 update-floppy.xml error: Failed to update device from update-floppy.xml error: Operation not supported: cannot modify field 'snapshot' of the disk Actual results: As step 2, update 'readonly' element report "cannot modify snapshot". Expected results: There should be no error message. Additional info: I guess that because I define guest without readonly, so the snapshot state should be VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT. then if I want to update device with readonly, it will change the snapshot value as following: virDomainDiskDefParseXML } else if (def->src->readonly) { def->snapshot = VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; } and then it will report error in qemuDomainDiskChangeSupported.
Fixed upstream: commit 662862ec5f20389fcc7c6f898630eb2a9c546b34 Author: Peter Krempa <pkrempa@redhat.com> Date: Thu Apr 28 17:57:33 2016 +0200 qemu: hotplug: Allow update of disk default snapshot location Since the field is internal to libvirt we can allow the users to modify it. commit 3b3debfb7f70696e55642ed34be2848d8ba4b8b7 Author: Peter Krempa <pkrempa@redhat.com> Date: Thu Apr 28 16:45:02 2016 +0200 qemu: domain: Check few more fields for when changing disk source Both disk->src->shared and disk->src->readonly can't be modified when changing disk source for floppy and cdrom drives since both arguments are passed as arguments of the disk rather than the image in qemu. Historically these fields have only two possible values since they are represented as XML thus we need to ignore if user did not provide them and thus we are treating them as false.
Verified version : libvirt-2.0.0-5.el7.x86_64 qemu-kvm-rhev-2.6.0-21.el7.x86_64 steps: 1. update readonly argument when update floppy device 1.1 define and start a guest as following # virsh dumpxml vm2 | grep disk -A 9 ....... <disk type='file' device='floppy'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/fd.img'/> <backingStore/> <target dev='fda' bus='fdc'/> <alias name='fdc0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 1.2 Preapare a floppy disk like following with external "readonly" # cat update-floppy.xml <disk type='file' device='floppy'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/fd.img'/> <target dev='fda' bus='fdc'/> <readonly/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 1.3 Report unsupport error # virsh update-device vm2 update-floppy.xml error: Failed to update device from update-floppy.xml error: Operation not supported: cannot modify field 'readonly' of the disk 2. change readonly to shareable, update again # cat update-floppy.xml <disk type='file' device='floppy'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/fd.img'/> <target dev='fda' bus='fdc'/> <shareable/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> 2.1 Report unsupport error # virsh update-device vm2 update-floppy.xml error: Failed to update device from update-floppy.xml error: Operation not supported: cannot modify field 'shared' of the disk 3. test disk and cdrom shareable and readonly also cannot be modified. move to verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html