|
|
d76c62 |
From d59261d209da6f3dd4dfef7fab327de7cbb6e7ff Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <d59261d209da6f3dd4dfef7fab327de7cbb6e7ff@dist-git>
|
|
|
d76c62 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Date: Tue, 4 Feb 2020 15:07:54 +0100
|
|
|
d76c62 |
Subject: [PATCH] qemu: checkpoint: tolerate missing disks on checkpoint
|
|
|
d76c62 |
deletion
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
If a disk is unplugged and then the user tries to delete a checkpoint
|
|
|
d76c62 |
the code would try to use NULL node name as it was not checked.
|
|
|
d76c62 |
|
|
|
d76c62 |
Fix this by fetching the whole disk definition object and verifying it
|
|
|
d76c62 |
was found.
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit f19248a1395e59abbd68ac31af3d9bd1273555bf)
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
|
|
|
d76c62 |
Message-Id: <bab5a0f3d17855a657a6b7de4699a72e176780d6.1580824112.git.pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_checkpoint.c | 23 +++++++++++++++++------
|
|
|
d76c62 |
1 file changed, 17 insertions(+), 6 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
|
|
|
d76c62 |
index 03a8321135..326707e098 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_checkpoint.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_checkpoint.c
|
|
|
d76c62 |
@@ -125,12 +125,15 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
|
|
|
d76c62 |
|
|
|
d76c62 |
for (i = 0; i < chkdef->ndisks; i++) {
|
|
|
d76c62 |
virDomainCheckpointDiskDef *chkdisk = &chkdef->disks[i];
|
|
|
d76c62 |
- const char *node;
|
|
|
d76c62 |
+ virDomainDiskDefPtr domdisk = virDomainDiskByTarget(vm->def, chkdisk->name);
|
|
|
d76c62 |
+
|
|
|
d76c62 |
+ /* domdisk can be missing e.g. when it was unplugged */
|
|
|
d76c62 |
+ if (!domdisk)
|
|
|
d76c62 |
+ continue;
|
|
|
d76c62 |
|
|
|
d76c62 |
if (chkdisk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
|
|
|
d76c62 |
continue;
|
|
|
d76c62 |
|
|
|
d76c62 |
- node = qemuDomainDiskNodeFormatLookup(vm, chkdisk->name);
|
|
|
d76c62 |
/* If any ancestor checkpoint has a bitmap for the same
|
|
|
d76c62 |
* disk, then this bitmap must be merged to the
|
|
|
d76c62 |
* ancestor. */
|
|
|
d76c62 |
@@ -153,20 +156,28 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
|
|
|
d76c62 |
if (!(arr = virJSONValueNewArray()))
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, node, chkdisk->bitmap) < 0)
|
|
|
d76c62 |
+ if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr,
|
|
|
d76c62 |
+ domdisk->src->nodeformat,
|
|
|
d76c62 |
+ chkdisk->bitmap) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
if (chkcurrent) {
|
|
|
d76c62 |
- if (qemuMonitorTransactionBitmapEnable(actions, node, disk2->bitmap) < 0)
|
|
|
d76c62 |
+ if (qemuMonitorTransactionBitmapEnable(actions,
|
|
|
d76c62 |
+ domdisk->src->nodeformat,
|
|
|
d76c62 |
+ disk2->bitmap) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (qemuMonitorTransactionBitmapMerge(actions, node, disk2->bitmap, &arr) < 0)
|
|
|
d76c62 |
+ if (qemuMonitorTransactionBitmapMerge(actions,
|
|
|
d76c62 |
+ domdisk->src->nodeformat,
|
|
|
d76c62 |
+ disk2->bitmap, &arr) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (qemuMonitorTransactionBitmapRemove(actions, node, chkdisk->bitmap) < 0)
|
|
|
d76c62 |
+ if (qemuMonitorTransactionBitmapRemove(actions,
|
|
|
d76c62 |
+ domdisk->src->nodeformat,
|
|
|
d76c62 |
+ chkdisk->bitmap) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.0
|
|
|
d76c62 |
|