Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1940036

Summary: [incremental_backup][migration_with_storage] When migration finished, the bitmap in the source image was not kept
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: yisun
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: yisun
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: fjin, pkrempa, virt-maint, yafu
Target Milestone: rcKeywords: Triaged
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-07-26 13:13:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description yisun 2021-03-17 13:47:53 UTC
Description of problem:
[incremental_backup][migration_with_storage] When migration finished, the bitmap in the source image was not kept

Version-Release number of selected component (if applicable):
libvirt-7.0.0-9.module+el8.4.0+10326+5e50a3b6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start a vm with image has no bitmaps
[root@dell-per740-01 ~]# virsh domblklist vm1
 Target   Source
--------------------------------------------------------
 vda      /var/lib/libvirt/images/jeos-27-x86_64.qcow2

[root@dell-per740-01 ~]# qemu-img info /var/lib/libvirt/images/jeos-27-x86_64.qcow2
image: /var/lib/libvirt/images/jeos-27-x86_64.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false
[root@dell-per740-01 ~]# virsh start vm1
Domain 'vm1' started

2. create a checkpoint for vm's vda
[root@dell-per740-01 ~]# virsh checkpoint-create-as vm1 --description test --name ck1 --diskspec vda,checkpoint=bitmap
Domain checkpoint ck1 created

3. do migration
[root@dell-per740-01 ~]# virsh migrate vm1 --live qemu+ssh://lenovo-sr630-10.lab.eng.pek2.redhat.com/system --verbose --copy-storage-all
root.eng.pek2.redhat.com's password: 
Migration: [100 %]

4. after migration, check the image's info on source host, the bitmap not saved in that image
[root@dell-per740-01 ~]# qemu-img info /var/lib/libvirt/images/jeos-27-x86_64.qcow2
image: /var/lib/libvirt/images/jeos-27-x86_64.qcow2
file format: qcow2
virtual size: 10 GiB (10737418240 bytes)
disk size: 1 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

5. if we use this vm on source host again, the checkpoint metadata and bitmap in image will be inconsistent
[root@dell-per740-01 ~]# virsh start vm1
Domain 'vm1' started
 
[root@dell-per740-01 ~]# virsh checkpoint-list vm1
 Name   Creation Time
-----------------------------------
 ck1    2021-03-16 08:20:58 -0400

[root@dell-per740-01 ~]# virsh checkpoint-delete vm1 ck1
error: Failed to delete checkpoint ck1
error: internal error: bitmap 'ck1' not found in backing chain of 'vda'


Expected results:
The checkpoint(bitmap) on the source host image should be kept.

Comment 1 Peter Krempa 2021-07-26 13:13:20 UTC
Bitmaps are deliberately not saved on the source of the migration when the bitmap migration is used. This is a deliberate decision done in qemu so that migration with shared storage can also use this feature. Said that the use case you are showing is uncommon at best as it involves rolling back state of disks. In general users are expected to either migrate back with the changes (and bitmaps) or copy the new images.

Solving this would require both work in qemu and libvirt and in general isn't very desired or useful, thus libvirt will not address this.