It is possible to specify any snapshot option for disk with empty source. Only cdrom and floppy can have empty source but cdrom is out of considering because it is always readonly (set on parse stage) and snapshotting readonly disks is now completely prohibited. Let's check floppies. In case of internal snapshot of such a disk for active or inactive domain snapshot returns success but actual snapshot is not possible of course. We need to prohibit this cases explicitly. In case of external snapshot of such a disk for active or inactive domain we get errors [1] and [2] respectively. It is better to have more user-frieldly messages. This patch prohibits explicitly all the above cases. [1] error in case of external disk snapshot of active domain error: internal error: unable to execute QEMU command 'transaction': Device 'drive-fdc0-0-0' has no medium [2] error in case of external disk snapshot of inactive domain error: internal error: Child process (/usr/local/bin/qemu-img create -f qcow2 \ -o 'backing_file=(null),backing_fmt=qcow2' /path/file.qcow2) \ unexpected exit status 1: qemu-img: /path/file.qcow2: \ Could not open '/path/(null)': No such file or directory Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- src/qemu/qemu_driver.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 506d8ab..bd3f00b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14760,6 +14760,13 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDiskDefPtr disk, return -1; } + if (virStorageSourceIsEmpty(disk->src)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshot for disk %s with empty source " + "is not possible"), disk->dst); + return -1; + } + if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0) return -1; @@ -14818,6 +14825,13 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDiskDefPtr disk, return -1; } + if (virStorageSourceIsEmpty(disk->src)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshot for disk %s with empty source " + "is not possible"), disk->dst); + return -1; + } + /* active disks are handled by qemu itself so no need to worry about those */ if (active) return 0; -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list