提交 f19248a1 编写于 作者: P Peter Krempa

qemu: checkpoint: tolerate missing disks on checkpoint deletion

If a disk is unplugged and then the user tries to delete a checkpoint
the code would try to use NULL node name as it was not checked.

Fix this by fetching the whole disk definition object and verifying it
was found.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 7973f7d7
......@@ -125,12 +125,15 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
for (i = 0; i < chkdef->ndisks; i++) {
virDomainCheckpointDiskDef *chkdisk = &chkdef->disks[i];
const char *node;
virDomainDiskDefPtr domdisk = virDomainDiskByTarget(vm->def, chkdisk->name);
/* domdisk can be missing e.g. when it was unplugged */
if (!domdisk)
continue;
if (chkdisk->type != VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP)
continue;
node = qemuDomainDiskNodeFormatLookup(vm, chkdisk->name);
/* If any ancestor checkpoint has a bitmap for the same
* disk, then this bitmap must be merged to the
* ancestor. */
......@@ -153,20 +156,28 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
if (!(arr = virJSONValueNewArray()))
return -1;
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, node, chkdisk->bitmap) < 0)
if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr,
domdisk->src->nodeformat,
chkdisk->bitmap) < 0)
return -1;
if (chkcurrent) {
if (qemuMonitorTransactionBitmapEnable(actions, node, disk2->bitmap) < 0)
if (qemuMonitorTransactionBitmapEnable(actions,
domdisk->src->nodeformat,
disk2->bitmap) < 0)
return -1;
}
if (qemuMonitorTransactionBitmapMerge(actions, node, disk2->bitmap, &arr) < 0)
if (qemuMonitorTransactionBitmapMerge(actions,
domdisk->src->nodeformat,
disk2->bitmap, &arr) < 0)
return -1;
}
}
if (qemuMonitorTransactionBitmapRemove(actions, node, chkdisk->bitmap) < 0)
if (qemuMonitorTransactionBitmapRemove(actions,
domdisk->src->nodeformat,
chkdisk->bitmap) < 0)
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册