Bug 1840053 - [incremental_backup] cannot do FULL backup for a READONLY disk
Summary: [incremental_backup] cannot do FULL backup for a READONLY disk
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
medium
Target Milestone: rc
: 8.3
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-26 09:53 UTC by yisun
Modified: 2020-11-17 17:49 UTC (History)
7 users (show)

Fixed In Version: libvirt-6.6.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-17 17:48:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yisun 2020-05-26 09:53:08 UTC
Description:
[incremental_backup] cannot do FULL backup for a READONLY disk

Versions:
libvirt-6.0.0-20.module+el8.2.1+6621+ddee07d5.x86_64

How reproducible:
100%

Steps:
1. Prepare a vm whose vda with tag <readonly>
[root@dell-per740xd-13 ~]# virsh dumpxml vm1 | awk '/<disk/,/<\/disk/'
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/vda.qcow2' index='1'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <readonly/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>

2. Prepare a backup xml
[root@dell-per740xd-13 ~]# cat backup.xml
<domainbackup>
  <disks>
     <disk name='vda' type='file'>
      <target file='/tmp/vda.backup'/>
      <driver type='qcow2'/>
    </disk>
  </disks>
</domainbackup>

3. Start a backup
[root@dell-per740xd-13 ~]# virsh backup-begin vm1 backup.xml
error: unsupported configuration: backup of readonly disk 'vda' makes no sense

Actual result:
Backup failed with error  ‘backup of readonly disk 'vda' makes no sense’

Expected result:
Since this is a full backup, so it’s not that ‘makes no sense’ to a readonly disk. Uplayer/Users may need to do a full data backup for all images, readonly or not.

Comment 1 Peter Krempa 2020-05-26 10:06:13 UTC
I'll asses whether it makes sense. Specifically we don't really want to add bitmaps in case when a backup is created together with a checkpoint.

Comment 2 Peter Krempa 2020-07-07 11:19:39 UTC
Fixed upstream:

commit 981222b682097f017e3fa8280426ccea9a444a48
Author: Peter Krempa <pkrempa>
Date:   Thu Jun 25 12:49:45 2020 +0200

    conf: backup: Don't explicitly forbid backup of read-only disk
    
    Users may want to use this to create a full backup or even incremental
    if the checkpoints are pre-existing. We still will not allow to create a
    checkpoint on a read-only disk as that makes no sense.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1840053
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Eric Blake <eblake>

Comment 5 yisun 2020-08-12 12:30:29 UTC
Tested with: libvirt-6.6.0-2.module+el8.3.0+7567+dc41c0a9.x86_64
Result: PASS

Steps:
1. having a vm with 2 disks, we'll use vdb to test
[root@dell-per730-67 ~]# virsh dumpxml vm1 | awk '/<disk/,/<\/disk/'
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/jeos-27-x86_64.qcow2' index='2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/vdb.qcow2' index='1'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </disk>

2. create a checkpoint for vdb
[root@dell-per730-67 ~]# virsh checkpoint-create vm1 check_0.xml 
Domain checkpoint checkpoint_0 created from 'check_0.xml'


3. generate 100M data in vdb
[root@dell-per730-67 ~]# virsh console vm1
Connected to domain vm1
[root@localhost ~]# dd if=/dev/urandom of=/dev/vdb bs=1M count=100; sync
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.705695 s, 149 MB/s

4. edit vm to set vdb as readonly disk and restart vm
[root@dell-per730-67 ~]# virsh dumpxml vm1 | awk '/<disk/,/<\/disk/'
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/vdb.qcow2'/>
      <target dev='vdb' bus='virtio'/>
      <readonly/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </disk>

[root@dell-per730-67 ~]# virsh start vm1
Domain vm1 started
<==== backup job successfully run

5. do a push-mode full backup
[root@dell-per730-67 ~]# cat backup_push_0.xml 
<domainbackup mode="push"><disks><disk backup="no" name="vda" /><disk backup="yes" name="vdb" type="file"><target file="/tmp/target_file_0" /><driver type="qcow2" /></disk></disks></domainbackup>

[root@dell-per730-67 ~]# virsh backup-begin vm1 backup_push_0.xml
Backup started

[root@dell-per730-67 ~]# qemu-img info /tmp/target_file_0
image: /tmp/target_file_0
file format: qcow2
virtual size: 1 GiB (1073741824 bytes)
disk size: 101 MiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

6. do a push-mode incremental backup
[root@dell-per730-67 ~]# cat backup_push_1.xml 
<domainbackup mode="push"><incremental>checkpoint_0</incremental><disks><disk backup="no" name="vda" /><disk backup="yes" name="vdb" type="file"><target file="/tmp/target_file_1" /><driver type="qcow2" /></disk></disks></domainbackup>

[root@dell-per730-67 ~]# virsh backup-begin vm1 backup_push_1.xml
Backup started

[root@dell-per730-67 ~]# qemu-img info /tmp/target_file_1
image: /tmp/target_file_1
file format: qcow2
virtual size: 1 GiB (1073741824 bytes)
disk size: 100 MiB
cluster_size: 65536
backing file: /var/lib/libvirt/images/vdb.qcow2
backing file format: qcow2
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
<==== backup job successfully run

7. do a pull-mode full backup
[root@dell-per730-67 ~]# cat backup_pull_0.xml 
<domainbackup mode="pull"><server socket="/tmp/pull_backup.socket" transport="unix" /><disks><disk backup="no" name="vda" /><disk backup="yes" name="vdb" type="file"><scratch file="/tmp/scratch_file_0" /></disk></disks></domainbackup>

[root@dell-per730-67 ~]# virsh backup-begin vm1 backup_pull_0.xml 
Backup started

[root@dell-per730-67 ~]# virsh domjobinfo vm1
Job type:         Unbounded   
Operation:        Backup      
Time elapsed:     11792        ms
Temporary disk space use: 0.000 B
Temporary disk space total: 1.000 GiB
<==== backup job successfully run

8. do a pull-mode incremental backup
[root@dell-per730-67 ~]# cat backup_pull_1.xml 
<domainbackup mode="pull"><incremental>checkpoint_0</incremental><server socket="/tmp/pull_backup.socket" transport="unix" /><disks><disk backup="no" name="vda" /><disk backup="yes" name="vdb" type="file"><scratch file="/tmp/scratch_file_1" /></disk></disks></domainbackup>
[root@dell-per730-67 ~]# virsh backup-begin vm1 backup_pull_1.xml 
Backup started

[root@dell-per730-67 ~]# virsh domjobinfo vm1
Job type:         Unbounded   
Operation:        Backup      
Time elapsed:     3582         ms
Temporary disk space use: 0.000 B
Temporary disk space total: 1.000 GiB
<==== backup job successfully run

9. try to create a checkpoint on vdb
[root@dell-per730-67 ~]# cat check_1.xml 
<domaincheckpoint><disks><disk checkpoint="no" name="vda" /><disk checkpoint="bitmap" name="vdb" /></disks><name>checkpoint_1</name><description>desc of cp_1</description></domaincheckpoint>
[root@dell-per730-67 ~]# virsh checkpoint-create vm1 check_1.xml 
error: unsupported configuration: disk 'vdb' is empty or readonly
<==== cannot create checkpoint on readonly disk, this is expected.

Comment 8 errata-xmlrpc 2020-11-17 17:48:38 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:8.3 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-2020:5137


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