qemu: backup: Enable full backup support

qemuBackupBegin can take a full backup of the disks (excluding any
operations with bitmaps) without the need to wait for the
blockdev-reopen support in qemu.

Add a check that no checkpoint creation is required and the disk backup
mode isn't VIR_DOMAIN_BACKUP_DISK_BACKUP_MODE_INCREMENTAL.

Call to virDomainBackupAlignDisks is moved earlier as it initializes the
disk backup mode if not present in user config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-03-18 15:11:55 +01:00
parent 12758f040a
commit 272017484e
2 changed files with 23 additions and 8 deletions

View File

@ -788,11 +788,32 @@ qemuBackupBegin(virDomainObjPtr vm,
goto endjob;
}
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("backup is not supported with this QEMU"));
goto endjob;
}
if (virDomainBackupAlignDisks(def, vm->def, suffix) < 0)
goto endjob;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
size_t i;
if (chkdef) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("creating checkpoint for incremental backup is not supported yet"));
goto endjob;
}
for (i = 0; i < def->ndisks; i++) {
if (def->disks[i].backupmode == VIR_DOMAIN_BACKUP_DISK_BACKUP_MODE_INCREMENTAL) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("incremental backup is not supported yet"));
goto endjob;
}
}
}
if (priv->backup) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
@ -806,9 +827,6 @@ qemuBackupBegin(virDomainObjPtr vm,
if (qemuBackupBeginPrepareTLS(vm, cfg, def, &tlsProps, &tlsSecretProps) < 0)
goto endjob;
if (virDomainBackupAlignDisks(def, vm->def, suffix) < 0)
goto endjob;
actions = virJSONValueNewArray();
/* The 'chk' checkpoint must be rolled back if the transaction command

View File

@ -2322,9 +2322,6 @@ qemuDomainObjPrivateXMLFormatBackups(virBufferPtr buf,
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP))
return 0;
if (priv->backup &&
virDomainBackupDefFormat(&childBuf, priv->backup, true) < 0)
return -1;