render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
d76c62
From dc4997ee498486135e46ca0e121835935bbf26db Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <dc4997ee498486135e46ca0e121835935bbf26db@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 4 Feb 2020 15:07:53 +0100
d76c62
Subject: [PATCH] qemu: checkpoint: Use disk definition directly when creating
d76c62
 checkpoint
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Lookup the whole disk definition rather than just the node name.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Eric Blake <eblake@redhat.com>
d76c62
(cherry picked from commit 7973f7d7926ac9dbc5464e6be6eb2aaacecc2251)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
d76c62
Message-Id: <d4ad0d55d36cfc8c1af9a997930936364e94648c.1580824112.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_checkpoint.c | 16 +++++++++++-----
d76c62
 1 file changed, 11 insertions(+), 5 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
d76c62
index 0aa854324b..03a8321135 100644
d76c62
--- a/src/qemu/qemu_checkpoint.c
d76c62
+++ b/src/qemu/qemu_checkpoint.c
d76c62
@@ -320,12 +320,16 @@ qemuCheckpointAddActions(virDomainObjPtr vm,
d76c62
 
d76c62
     for (i = 0; i < def->ndisks; i++) {
d76c62
         virDomainCheckpointDiskDef *chkdisk = &def->disks[i];
d76c62
-        const char *node;
d76c62
+        virDomainDiskDefPtr domdisk = virDomainDiskByTarget(vm->def, chkdisk->name);
d76c62
 
d76c62
-        if (chkdisk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
d76c62
+        /* checkpoint definition validator mandates that the corresponding
d76c62
+         * domdisk should exist */
d76c62
+        if (!domdisk ||
d76c62
+            chkdisk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
d76c62
             continue;
d76c62
-        node = qemuDomainDiskNodeFormatLookup(vm, chkdisk->name);
d76c62
-        if (qemuMonitorTransactionBitmapAdd(actions, node, chkdisk->bitmap, true, false, 0) < 0)
d76c62
+
d76c62
+        if (qemuMonitorTransactionBitmapAdd(actions, domdisk->src->nodeformat,
d76c62
+                                            chkdisk->bitmap, true, false, 0) < 0)
d76c62
             return -1;
d76c62
 
d76c62
         /* We only want one active bitmap for a disk along the
d76c62
@@ -348,7 +352,9 @@ qemuCheckpointAddActions(virDomainObjPtr vm,
d76c62
                 if (STRNEQ(chkdisk->name, disk2->name) ||
d76c62
                     disk2->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
d76c62
                     continue;
d76c62
-                if (qemuMonitorTransactionBitmapDisable(actions, node, disk2->bitmap) < 0)
d76c62
+                if (qemuMonitorTransactionBitmapDisable(actions,
d76c62
+                                                        domdisk->src->nodeformat,
d76c62
+                                                        disk2->bitmap) < 0)
d76c62
                     return -1;
d76c62
                 search_parents = false;
d76c62
                 break;
d76c62
-- 
d76c62
2.25.0
d76c62