+++ 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
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
Pre-verfified on libvirt v7.5.0-246-gcd72f0cd9f and qemu-6.0.0-10.fc35.x86_64 as comment0
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
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