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 1302171 - [blockcopy] unknown error while virtlockd is on
Summary: [blockcopy] unknown error while virtlockd is on
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-27 02:10 UTC by Han Han
Modified: 2017-08-01 23:51 UTC (History)
5 users (show)

Fixed In Version: libvirt-3.0.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:09:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
logs (50.35 KB, application/x-xz)
2016-01-27 02:10 UTC, Han Han
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Han Han 2016-01-27 02:10:50 UTC
Created attachment 1118647 [details]
logs

Description of problem:
When virtlockd is on, do blockcopy to a unprivileged dir or from a nfs dir will cause unknown error.

Version-Release number of selected component (if applicable):
libvirt-1.2.17-13.el7_2.2.x86_64
qemu-kvm-rhev-2.3.0-31.el7_2.7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Setup virtlockd env
# cat /etc/libvirt/qemu-lockd.conf
auto_disk_leases = 1
require_lease_for_disks = 1
file_lockspace_dir = "/var/lib/libvirt/lockd/files"

# cat /etc/libvirt/qemu.conf
lock_manager = "lockd"

# systemctl restart virtlockd && systemctl restart libvirtd


2. blockcopy for a transient running guest whose os image based on nfs.
# setsebool virt_use_nfs 1

# df -h |grep hhan
xx.xx.xx.xx:/xx/xx/hhan  975G  513G  463G  53% /nfs

#virsh blockcopy n3 vda /var/lib/libvirt/images/n3.cpy --wait --verbose                                         
error: An error occurred, but the cause is unknown


3. Prepare a local transient running guest, do blockcopy to /root dir
# virsh blockcopy n2 vda /root/n2.cpy --wait --verbose
error: An error occurred, but the cause is unknown

Actual results:
As step2&3 shows.


Expected results:
Step2 should finish blockcopy successfully. 
Step3 should be the error:
error: internal error: unable to execute QEMU command 'drive-mirror': Could not create file: Permission denied

Additional info:
Because the step2 and step3 are both unknown error in virtlockd&blockcopy environment, report them as one bug. Pls split to two bugs if necessary.

Comment 2 Peter Krempa 2016-12-19 16:30:04 UTC
Fixed upstream:

commit 8551d39f4fbdb56551882ad3b48feb172da42ed6
Author: Peter Krempa <pkrempa>
Date:   Thu Dec 15 15:09:47 2016 +0100

    qemu: blockcopy: Save monitor error prior to calling into lock manager
    
    The error would be overwritten otherwise producing a meaningless error
    message.

Comment 4 yisun 2017-02-27 03:19:29 UTC
Verified on libvirt-3.0.0-2.el7.x86_64 & qemu-kvm-rhev-2.8.0-4.el7.x86_64

============= scenario 1: blockcopy to a nfs dir =============
## cat /etc/libvirt/qemu-lockd.conf
auto_disk_leases = 1
require_lease_for_disks = 1
file_lockspace_dir = "/var/lib/libvirt/lockd/files"

## cat /etc/libvirt/qemu.conf
lock_manager = "lockd"

## systemctl restart virtlockd && systemctl restart libvirtd

## mount | grep /tt
localhost:/home/nfs on /tt type nfs (rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=localhost,mountvers=3,mountport=20048,mountproto=udp,local_lock=none,addr=localhost)

## setsebool virt_use_nfs 1

## virsh create ~/vm1
Domain vm1 created from /root/vm1

## virsh blockcopy vm1 vda /var/lib/libvirt/images/vm1.cpy --wait --verbose                                         
Block Copy: [100 %]
Now in mirroring phase
<=== expected completion

## virsh dumpxml vm1 | grep disk -a10
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.3-latest.img'/>
      <backingStore/>
      <mirror type='file' file='/var/lib/libvirt/images/vm1.cpy' format='qcow2' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source file='/var/lib/libvirt/images/vm1.cpy'/>
      </mirror>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
...

============= scenario 2: blockcopy to root dir =============
## virsh create ~/vm1
Domain vm1 created from /root/vm1

## virsh blockcopy vm1 vda /root/vm1.cpy --wait --verbose
error: internal error: unable to execute QEMU command 'drive-mirror': Could not create file: Permission denied
<=== expected with clear error message


## virsh dumpxml vm1 | grep disk -a10
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.3-latest.img'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
...

Comment 5 errata-xmlrpc 2017-08-01 17:09:12 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://access.redhat.com/errata/RHEA-2017:1846

Comment 6 errata-xmlrpc 2017-08-01 23:51:16 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://access.redhat.com/errata/RHEA-2017:1846


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