Bug 1778058 - Cannot blockcopy to a block device as target
Summary: Cannot blockcopy to a block device as target
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.2
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: 8.0
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-29 07:34 UTC by yisun
Modified: 2020-11-06 04:41 UTC (History)
8 users (show)

Fixed In Version: libvirt-6.0.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-05 09:51:23 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
libvirtd log (201.25 KB, text/plain)
2019-11-29 07:34 UTC, yisun
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2017 0 None None None 2020-05-05 09:51:57 UTC

Description yisun 2019-11-29 07:34:12 UTC
Created attachment 1640591 [details]
libvirtd log

Description of problem:
Cannot blockcopy to a block device as target

Version-Release number of selected component (if applicable):
libvirt-5.9.0-4.module+el8.2.0+4836+a8e32ad7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. having a block device on host (/dev/sda here)
# lsscsi
[2:0:0:0]    disk    LIO-ORG  device.logical-  4.0   /dev/sda 
# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 1000M  0 disk 

2. having a transient running vm
# virsh list
...
--------------------------------
 1    avocado-vt-vm1   running


# virsh domblklist avocado-vt-vm1
...
----------------------------------------------------------------------
 vda    /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2


# virsh undefine avocado-vt-vm1

3. do block copy, error happened
# virsh blockcopy avocado-vt-vm1 vda /dev/sda  --blockdev
Error:unable to verify existence of block copy target: Function not implemented

Actual results:
block copy failed

Expected results:
no failure

Additional info:
A regression failure on rhel8.2.0, not reproduced on rhel8.1.0
libvirtd log as attachment

Comment 2 Peter Krempa 2019-11-29 09:04:12 UTC
The code path for the block device forgot to initialize the virStorageSource and thus the subsequent API uses fail for it.

Comment 4 Peter Krempa 2019-12-02 14:50:25 UTC
Fixed upstream by:

commit 6519c1b55413b8d8d32d0cfe97ba99cb21e8ff8c (HEAD -> master, origin/master, origin/HEAD)
Author: Peter Krempa <pkrempa>
Date:   Fri Nov 29 14:33:05 2019 +0100

    qemu: blockcopy: Fix conditions when virStorageSource should be initialized
    
    Commit 4b58fdf280a which enabled block copy also for network
    destinations needed to limit when the 'mirror' storage source is
    initialized in cases when we e.g. don't have an appropriate backend.
    
    Limiting it just to virStorageFileSupportsCreate is too restrictive as
    for example we can't precreate block devices and thus wouldn't
    initialize the 'mirror' but since it's a local source we'd try to
    examine it. This would fail since it wouldn't be initialized.
    
    Fix it by introducing a more granular check whether certain operations
    are supported and fix the check interlocks.

v5.10.0-rc2-7-g6519c1b554

Comment 6 yisun 2020-01-19 13:06:55 UTC
Verified with libvirt-6.0.0-1
[root@dell-per730-67 ~]# rpm -qa | grep libvirt-6
libvirt-6.0.0-1.module+el8.2.0+5453+31b2b136.x86_64

1. Having a local scsi disk
(.libvirt-ci-venv-ci-runtest-jcaFve) [root@dell-per730-67 ~]# lsblk
...
sdb                              8:16   0   9.8G  0 disk

2. Do blockcopy of transient vm's vda to local disk sdb 
(.libvirt-ci-venv-ci-runtest-jcaFve) [root@dell-per730-67 ~]# virsh blockcopy vm1 vda /dev/sdb  --blockdev
Block Copy started

[root@dell-per730-67 ~]# virsh blockjob vm1 vda
Block Copy: [100 %]

3. Do blockjob --pivot and check the /dev/sdb copied successfully
[root@dell-per730-67 ~]# virsh blockjob vm1 vda --pivot

[root@dell-per730-67 ~]# virsh domblklist vm1
 Target   Source
--------------------
 vda      /dev/sdb


[root@dell-per730-67 ~]# virsh console vm1
Connected to domain vm1
Escape character is ^]

Red Hat Enterprise Linux 8.2 Beta (Ootpa)
Kernel 4.18.0-167.el8.x86_64 on an x86_64

localhost login: root
Password:
Last login: Sun Jan 19 15:10:09 from 192.168.122.1
[root@localhost ~]#

Comment 8 errata-xmlrpc 2020-05-05 09:51:23 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/RHBA-2020:2017


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