|
|
fbe740 |
From 97a6adcb3ac735ff135469aa602c798fbc0b1491 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <97a6adcb3ac735ff135469aa602c798fbc0b1491@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Tue, 23 Jun 2020 12:23:36 +0200
|
|
|
fbe740 |
Subject: [PATCH] qemu: backup: Fix backup of disk skipped in an intermediate
|
|
|
fbe740 |
checkpoint
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
If a disk is not captured by one of the intermediate checkpoints the
|
|
|
fbe740 |
code would fail, but we can easily calculate the bitmaps to merge
|
|
|
fbe740 |
correctly by skipping over checkpoints which don't describe the disk.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit c89a44777fdf89b400878adcb03a3557bcec3f4e)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
|
|
|
fbe740 |
Message-Id: <d0efe760e9f8049758691b7f66a7de41fce5c264.1592906423.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_backup.c | 24 ++++++++++++++++++++++++
|
|
|
fbe740 |
tests/qemublocktest.c | 6 ++++++
|
|
|
fbe740 |
2 files changed, 30 insertions(+)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
|
|
|
fbe740 |
index 400b711f79..adbf696de6 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_backup.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_backup.c
|
|
|
fbe740 |
@@ -240,6 +240,30 @@ qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental,
|
|
|
fbe740 |
for (incridx = 0; incremental[incridx]; incridx++) {
|
|
|
fbe740 |
g_autoptr(virJSONValue) tmp = virJSONValueNewArray();
|
|
|
fbe740 |
virStorageSourcePtr tmpsrc = NULL;
|
|
|
fbe740 |
+ virDomainCheckpointDefPtr chkdef = (virDomainCheckpointDefPtr) incremental[incridx];
|
|
|
fbe740 |
+ bool checkpoint_has_disk = false;
|
|
|
fbe740 |
+ size_t i;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ for (i = 0; i < chkdef->ndisks; i++) {
|
|
|
fbe740 |
+ if (STRNEQ_NULLABLE(diskdst, chkdef->disks[i].name))
|
|
|
fbe740 |
+ continue;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (chkdef->disks[i].type == VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
|
|
|
fbe740 |
+ checkpoint_has_disk = true;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ break;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (!checkpoint_has_disk) {
|
|
|
fbe740 |
+ if (!incremental[incridx + 1]) {
|
|
|
fbe740 |
+ virReportError(VIR_ERR_INVALID_ARG,
|
|
|
fbe740 |
+ _("disk '%s' not found in checkpoint '%s'"),
|
|
|
fbe740 |
+ diskdst, incremental[incridx]->name);
|
|
|
fbe740 |
+ return NULL;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ continue;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
|
|
|
fbe740 |
if (qemuBackupGetBitmapMergeRange(n, incremental[incridx]->name,
|
|
|
fbe740 |
&tmp, &tmpsrc, diskdst,
|
|
|
fbe740 |
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
|
|
|
fbe740 |
index e461b3a23d..d15965d9eb 100644
|
|
|
fbe740 |
--- a/tests/qemublocktest.c
|
|
|
fbe740 |
+++ b/tests/qemublocktest.c
|
|
|
fbe740 |
@@ -727,6 +727,12 @@ testQemuBackupGetIncrementalMoment(const char *name)
|
|
|
fbe740 |
if (!(checkpoint = virDomainCheckpointDefNew()))
|
|
|
fbe740 |
abort();
|
|
|
fbe740 |
|
|
|
fbe740 |
+ checkpoint->disks = g_new0(virDomainCheckpointDiskDef, 1);
|
|
|
fbe740 |
+ checkpoint->ndisks = 1;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ checkpoint->disks[0].name = g_strdup("testdisk");
|
|
|
fbe740 |
+ checkpoint->disks[0].type = VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
checkpoint->parent.name = g_strdup(name);
|
|
|
fbe740 |
|
|
|
fbe740 |
return (virDomainMomentDefPtr) checkpoint;
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.27.0
|
|
|
fbe740 |
|