[PATCH 2/3] qemu: backup: Enable full backup support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_backup.c | 28 +++++++++++++++++++++++-----
 src/qemu/qemu_domain.c |  3 ---
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index f91d632715..d89122f225 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -788,12 +788,33 @@ qemuBackupBegin(virDomainObjPtr vm,
         goto endjob;
     }

-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) {
+    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_BACKUP)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                       _("incremental backup is not supported yet"));
+                       _("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",
                        _("another backup job is already running"));
@@ -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
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed2a1481d4..5c98f8ff1a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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;
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux