RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1328301 - update floppy device with readonly element report cannot modify snapshot error
Summary: update floppy device with readonly element report cannot modify snapshot error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-19 01:32 UTC by Pei Zhang
Modified: 2016-11-03 18:43 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.3.5-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:43:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Pei Zhang 2016-04-19 01:32:28 UTC
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 07:13:33 UTC
Fixed upstream:

commit 662862ec5f20389fcc7c6f898630eb2a9c546b34
Author: Peter Krempa <pkrempa>
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>
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 10:12:13 UTC
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 18:43:05 UTC
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.