Bug 1302171 - [blockcopy] unknown error while virtlockd is on
[blockcopy] unknown error while virtlockd is on
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Peter Krempa
yisun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-26 21:10 EST by Han Han
Modified: 2017-08-01 19:51 EDT (History)
5 users (show)

See Also:
Fixed In Version: libvirt-3.0.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 13:09:12 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)
logs (50.35 KB, application/x-xz)
2016-01-26 21:10 EST, Han Han
no flags Details

  None (edit)
Description Han Han 2016-01-26 21:10:50 EST
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 11:30:04 EST
Fixed upstream:

commit 8551d39f4fbdb56551882ad3b48feb172da42ed6
Author: Peter Krempa <pkrempa@redhat.com>
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-26 22:19:29 EST
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 13:09:12 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://access.redhat.com/errata/RHEA-2017:1846
Comment 6 errata-xmlrpc 2017-08-01 19:51:16 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://access.redhat.com/errata/RHEA-2017:1846

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