Bug 2001327
| Summary: | Wrong backing-fmt in QMP command when do push mode incremental backup for luks encrypted qcow2 disk | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | John Ferlan <jferlan> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| libvirt sub component: | General | QA Contact: | yisun |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | low | ||
| Priority: | low | CC: | fjin, jdenemar, lmen, pkrempa, virt-maint, xuzhang, yisun |
| Version: | 9.0 | Keywords: | AutomationTriaged, Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-7.7.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1995865 | Environment: | |
| Last Closed: | 2022-05-17 12:45:08 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: | 7.7.0 |
| Embargoed: | |||
| Bug Depends On: | 1995865 | ||
| Bug Blocks: | |||
|
Description
John Ferlan
2021-09-05 14:24:14 UTC
verified with: libvirt-7.7.0-3.el9.x86_64
1. prepare x partitions /dev/sdb1 to /dev/sdb3 (Can use iscsi or any other block device)
[root@dell-per740xd-25 ~]# ll /dev/sdb?
brw-rw----. 1 root disk 8, 17 Sep 30 03:58 /dev/sdb1
brw-rw----. 1 root disk 8, 18 Sep 30 03:58 /dev/sdb2
brw-rw----. 1 root disk 8, 19 Sep 30 03:58 /dev/sdb3
brw-rw----. 1 root disk 8, 20 Sep 30 03:58 /dev/sdb4
2. prepare a qcow2 native luks-encrypted image and use it in vm as vdb
[root@dell-per740xd-25 ~]# qemu-img create --object secret,id=sec0,data=redhat -f qcow2 -o encrypt.format=luks,encrypt.key-secret=sec0 /var/lib/libvirt/images/vdb.qcow2 200M
Formatting '/var/lib/libvirt/images/vdb.qcow2', fmt=qcow2 encrypt.format=luks encrypt.key-secret=sec0 cluster_size=65536 extended_l2=off compression_type=zlib size=209715200 lazy_refcounts=off refcount_bits=16
[root@dell-per740xd-25 ~]# cat secret.xml
<secret ephemeral='no' private='yes'>
<description>LUKS Secret</description>
<usage type='volume'>
<volume>/just/a/path</volume>
</usage>
</secret>
[root@dell-per740xd-25 ~]# virsh secret-define secret.xml
Secret cba89c46-bae8-4e17-8b0b-2326fcd25d73 created
[root@dell-per740xd-25 ~]# MYSECRET=`printf %s "redhat" | base64`
[root@dell-per740xd-25 ~]# virsh secret-set-value cba89c46-bae8-4e17-8b0b-2326fcd25d73 $MYSECRET
error: Passing secret value as command-line argument is insecure!
Secret value set
[root@dell-per740xd-25 ~]# virsh edit vm1
...
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/vdb.qcow2' index='1'>
<encryption format='luks'>
<secret type='passphrase' uuid='cba89c46-bae8-4e17-8b0b-2326fcd25d73'/>
</encryption>
</source>
<backingStore/>
<target dev='vdb' bus='virtio'/>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
</disk>
[root@dell-per740xd-25 ~]# virsh start vm1
Domain 'vm1' started
3. prepare round 1 backup xmls
[root@dell-per740xd-25 ~]# cat backup_full.xml
<domainbackup mode='push'>
<disks>
<disk name='vda' backup='no' />
<disk name='vdb' backup='yes' type='block' backupmode='full'>
<driver type='qcow2'/>
<target dev='/dev/sdb1'>
<encryption format='luks'>
<secret type='passphrase' usage='/just/a/path'/>
</encryption>
</target>
</disk>
</disks>
</domainbackup>
[root@dell-per740xd-25 ~]# cat ck1.xml
<domaincheckpoint>
<name>ck1</name>
<disks>
<disk checkpoint='no' name='vda'/>
<disk checkpoint='bitmap' name='vdb'/>
</disks>
</domaincheckpoint>
4. start round 1 - full backup
[root@dell-per740xd-25 ~]# virsh backup-begin vm1 backup_full.xml ck1.xml
Backup started
[root@dell-per740xd-25 ~]# virsh domjobinfo vm1 --completed
Job type: Completed
Operation: Backup
Time elapsed: 7328 ms
File processed: 200.000 MiB
File remaining: 0.000 B
File total: 200.000 MiB
5. prepare round 2 backup xml
[root@dell-per740xd-25 ~]# cat backup_inc.xml
<domainbackup mode='push'>
<disks>
<disk name='vda' backup='no' />
<disk name='vdb' backup='yes' type='block' backupmode='incremental' incremental='ck1'>
<driver type='qcow2'/>
<target dev='/dev/sdb2'>
<encryption format='luks'>
<secret type='passphrase' usage='/just/a/path'/>
</encryption>
</target>
</disk>
</disks>
</domainbackup>
6. start round 2 - incremental backup
[root@dell-per740xd-25 ~]# virsh backup-begin vm1 backup_inc.xml
Backup started
[root@dell-per740xd-25 ~]# virsh domjobinfo vm1 --completed
Job type: Completed
Operation: Backup
Time elapsed: 7319 ms
7. (optional step) check the libvirtd debug log. When create incremental backup image, the base image's format is 'qcow2' but not 'luks' ("backing-file":"/var/lib/libvirt/images/vdb.qcow2","backing-fmt":"qcow2")
2021-09-30 09:07:09.686+0000: 163978: info : qemuMonitorSend:956 : QEMU_MONITOR_SEND_MSG: mon=0x7fc240005090 msg={"execute":"blockdev-create","arguments":{"job-id":"create-libvirt-4-format","options":{"driver":"qcow2","file":"libvirt-4-storage","size":209715200,"cluster-size":65536,"backing-file":"/var/lib/libvirt/images/vdb.qcow2","backing-fmt":"qcow2","encrypt":{"key-secret":"libvirt-4-format-encryption-secret0","format":"luks"}}},"id":"libvirt-29"}
8. check the incremtnal backup target file's backing chain info.
[root@dell-per740xd-25 ~]# qemu-img info --backing-chain /dev/sdb2 -U
image: /dev/sdb2
file format: qcow2
virtual size: 200 MiB (209715200 bytes)
...
encrypted: yes
cluster_size: 65536
backing file: /var/lib/libvirt/images/vdb.qcow2
backing file format: qcow2
...
image: /var/lib/libvirt/images/vdb.qcow2
file format: qcow2
virtual size: 200 MiB (209715200 bytes)
disk size: 3.25 MiB
encrypted: yes
...
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 (new packages: libvirt), 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-2022:2390 |