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 1555311 - Creating external snapshot will fail after failed hot-plugging operation
Summary: Creating external snapshot will fail after failed hot-plugging operation
Keywords:
Status: CLOSED DUPLICATE of bug 1524792
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: jiyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-14 13:09 UTC by jiyan
Modified: 2018-03-15 13:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-15 13:56:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description jiyan 2018-03-14 13:09:23 UTC
Description of problem:
After hot-plugging same qcow2 file which is the source of bootable disk in VM, creating external snapshot will fail. 

Version-Release number of selected component (if applicable):
kernel-3.10.0-860.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7.x86_64
libvirt-3.9.0-14.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
Steps:
1. Prepare a shutdown VM with bootable source file as following:
# virsh domstate test4
shut off

# virsh dumpxml test4 |grep "<disk" -A5
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2. Prepare a xml file, the source file is same with Step-1.
# cat test4.xml 
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <target dev='hdb' bus='virtio'/>
    </disk>

3. Start VM and hot-plug, the error will raise
# virsh start test4
Domain test4 started

# virsh attach-device test4 test4.xml 
error: Failed to attach device from test4.xml
error: internal error: unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk1' could not be initialized


4. Try to create external snapshot, it will fail
# virsh snapshot-create-as test4 t4s1 --disk-only --diskspec hda,snapshot=external,file=/tmp/t4s1
error: internal error: unable to execute QEMU command 'transaction': Failed to lock byte 100

Actual results:
As step-4 shows

Expected results:
Creating snapshot should succeed.

Additional info:
The error info in step-3 is related to the following bug:
Bug 1526313 - Improve QEMU lock error info for hot-plugging same qcow2 image file twice in different target to VM

And famz has been checked this issue and provides some debug info as following: 
https://bugzilla.redhat.com/show_bug.cgi?id=1526313#c6
I find that disabling SELinux will fix the issue. My guess is that the error handling logic in libvirt triggered in step 3 has misconfigured the context of the image or something, as a result, a following locking operation when QEMU tries to create the snapshot is rejected by system security policy:

[pid  9863] fcntl(17, F_OFD_SETLK, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=100, l_len=1}) = -1 EACCES (Permission denied)

Comment 2 Peter Krempa 2018-03-15 13:56:31 UTC
This is an instance of libvirtd breaking the label on a VM if the operation fails for some reason. We have a different instance of this bug when starting two VMs with same disk image which does not support sharing. Closing this as a duplicate.

Comment 3 Peter Krempa 2018-03-15 13:56:44 UTC

*** This bug has been marked as a duplicate of bug 1524792 ***


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