Bug 2171344

Summary: Save guest when doing backup should report error directly
Product: Red Hat Enterprise Linux 9 Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: Meina Li <meili>
Status: CLOSED MIGRATED Docs Contact:
Severity: low    
Priority: low CC: lmen, virt-maint, xuzhang, yisun
Version: 9.3Keywords: MigratedToJIRA, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-07 21:22:43 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 Lili Zhu 2023-02-20 03:42:03 UTC
Description of problem:
Save guest when doing backup doest not report error directly, it reports error after time out

Version-Release number of selected component (if applicable):
libvirt-9.0.0-5.el9.x86_64
qemu-kvm-7.2.0-8.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. prepare backup and checkpoint xml files
[root@dell-per740xd-11 inc_bkup]# cat backup_full_pull.xml checkpoint_full_pull.xml
<domainbackup mode='pull'>
  <server name="localhost" port="10809"/>
  <disks>
    <disk name='vda' backup='yes' type='file'>
    <scratch file='/mnt/sratch.vda'/>
    </disk>
  </disks>
</domainbackup>

<domaincheckpoint>
  <name>check_full</name>
  <disks>
    <disk name='vda' checkpoint='bitmap'/>
  </disks>
</domaincheckpoint>

2. Start full backup
[root@dell-per740xd-11 inc_bkup]# virsh backup-begin avocado-vt-vm1 backup_full_pull.xml checkpoint_full_pull.xml
Backup started

[root@dell-per740xd-11 inc_bkup]# qemu-img convert -f raw nbd://localhost:10809/vda -O qcow2 /var/lib/libvirt/images/vda.full.backup

4. Do save before abort the backup job
[root@dell-per740xd-11 inc_bkup]# virsh save avocado-vt-vm1 /tmp/vm1.save
error: Failed to save domain 'avocado-vt-vm1' to vm1.save
error: Timed out during operation: cannot acquire state change lock (held by monitor=remoteDispatchDomainBackupBegin)

Actual results:
Save guest when doing backup does not report error directly, it reports error after time out

Expected results:
libvirt should report the following error directly
error: "domain has active block job" or "another backup job is already running"

Comment 1 Peter Krempa 2023-02-20 15:36:32 UTC
Note that this case is the same as if you try to start a modify job when the VM is migrating.