Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1328301 - update floppy device with readonly element report cannot modify snapshot error
update floppy device with readonly element report cannot modify snapshot error
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-18 21:32 EDT by Pei Zhang
Modified: 2016-11-03 14:43 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-1.3.5-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:43:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 08:07:06 EDT

  None (edit)
Description Pei Zhang 2016-04-18 21:32:28 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.
Comment 2 Peter Krempa 2016-05-02 03:13:33 EDT
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.
Comment 4 Pei Zhang 2016-08-22 06:12:13 EDT
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.
Comment 6 errata-xmlrpc 2016-11-03 14:43:05 EDT
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

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