1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemuSnapshotPrepareDiskExternal: Reject creation of block devices sooner

In case when the snapshot target is of VIR_STORAGE_TYPE_BLOCK type and
doesn't exist libvirt won't be able to create it. Reject such a config
sooner.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-06-16 14:57:06 +02:00
parent a96cc845d7
commit 66adff17a8

View File

@ -589,6 +589,13 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm,
_("missing existing file for disk %s: %s"),
snapdisk->name, snapdisk->src->path);
return -1;
} else {
if (snapdisk->src->type == VIR_STORAGE_TYPE_BLOCK) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("block device snapshot target '%s' doesn't exist"),
snapdisk->src->path);
return -1;
}
}
} else {
if (!S_ISBLK(st.st_mode) && st.st_size && !reuse) {