Bug 1978716 - Storage is not copied at all when do vm live migration with --copy-storage-inc
Summary: Storage is not copied at all when do vm live migration with --copy-storage-inc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: 8.5
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On: 1978526
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-02 14:47 UTC by Fangge Jin
Modified: 2021-11-16 08:53 UTC (History)
8 users (show)

Fixed In Version: libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1978526
Environment:
Last Closed: 2021-11-16 07:54:28 UTC
Type: Bug
Target Upstream Version: 7.6.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:55:15 UTC

Description Fangge Jin 2021-07-02 14:47:43 UTC
+++ This bug was initially created as a clone of Bug #1978526 +++

Description of problem:
As subject

Version-Release number of selected component (if applicable):
qemu-kvm-6.0.0-21.module+el8.5.0+11555+e0ab0d09.x86_64
libvirt-client-7.4.0-1.module+el8.5.0+11218+83343022.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Start a vm with local storage

2. Pre-create the disk image on target host manually
# qemu-img create -f qcow2 /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 10G

# qemu-img info /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 -U
image: /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 196 KiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false


2. Migrate vm with --copy-storage-inc
# virsh migrate avocado-vt-vm1 qemu+ssh://******/system --live --verbose --copy-storage-inc

3. Check the disk image on dest host, found its size is small
# qemu-img info /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2 -U
image: /var/lib/avocado/data/avocado-vt/images/jeos-27-x86_64.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 5.01 MiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

4. Try to login to vm on dest host, failed

5. Check libvirtd.log, can't find blockdev-add 



Actual results:
As description


Expected results:
Disk should be copied during migration when --copy-storage-inc is used


Additional info:
Can't reproduce with --copy-storage-all

--- Additional comment from Fangge Jin on 2021-07-02 05:12:26 UTC ---



--- Additional comment from Han Han on 2021-07-02 08:19:43 UTC ---

Reproduced on libvirt-7.4.0-1.el9.x86_64 qemu-kvm-6.0.0-4.el9.x86_64.
See the qmp log files generated by qemu-monitor.stp.

--- Additional comment from Peter Krempa on 2021-07-02 11:58:59 UTC ---

The problem happens because a wrong constant was used in the logic expression which is used to determine whether storage migration needs to take place.

The original condition is:

bool storageMigration = flags & (VIR_MIGRATE_NON_SHARED_DISK | QEMU_MONITOR_MIGRATE_NON_SHARED_INC);

The correct one is:

bool storageMigration = flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC);

QEMU_MONITOR_MIGRATE_NON_SHARED_INC equals to 0x04
VIR_MIGRATE_NON_SHARED_INC equals to 0x80

Comment 1 Peter Krempa 2021-07-12 14:42:40 UTC
Fixed upstream:

commit b249fa78718cd6c21109b385b568ecd3d6a3a8dd
Author: Peter Krempa <pkrempa>
Date:   Fri Jul 2 14:17:58 2021 +0200

    NEWS: Mention implications of the bug in migration code
    
    Wrong flag use could have user-visible implications. Mention the fix.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

commit f58349c9c6d26d98e7c8c195b1160d0c0cfff080
Author: Peter Krempa <pkrempa>
Date:   Fri Jul 2 14:17:57 2021 +0200

    qemu: migration: Use correct flag constant for enabling storage migration
    
    The 'storageMigration' flag is supposed to be true if storage migration
    is requested, which is based on VIR_MIGRATE_NON_SHARED_DISK or
    VIR_MIGRATE_NON_SHARED_INC flags. The assignment to the variable used
    QEMU_MONITOR_MIGRATE_NON_SHARED_INC (0x04) instead of
    VIR_MIGRATE_NON_SHARED_INC (0x80), caused libvirtd to skip the actual
    copy of data.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1978526
    Fixes: da69f4b2084bff140238e450e264d6036ebef898
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

v7.5.0-44-gb249fa7871

Comment 2 Han Han 2021-07-26 03:30:26 UTC
Pre-verfified on libvirt v7.5.0-246-gcd72f0cd9f and qemu-6.0.0-10.fc35.x86_64 as comment0

Comment 5 Han Han 2021-08-04 03:42:41 UTC
Verified on libvirt-7.6.0-1.module+el8.5.0+12097+2c77910b.x86_64 qemu-kvm-6.0.0-26.module+el8.5.0+12044+525f0ebc.x86_64

Comment 7 errata-xmlrpc 2021-11-16 07:54:28 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 (virt:av bug fix and enhancement update), 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-2021:4684


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