From 23f38f8813fb39e45e32aad228a7da0fec63ffee Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 29 May 2014 11:02:43 +0200 Subject: [PATCH] qemu: snapshot: Improve detection of mixed snapshots Currently we don't support mixed (external + internal) snapshots. The code detecting the snapshot type didn't make sure that the memory image was consistent with the snapshot type leading into strange error message: $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah error: internal error: unexpected code path Fix the mixed detection code to detect this kind of mistake: $ virsh snapshot-create-as --domain VM --diskspec vda,snapshot=internal --memspec snapshot=external,file=/tmp/blah error: unsupported configuration: mixing internal and external targets for a snapshot is not yet supported --- src/qemu/qemu_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 272687d3ba..59185c62fe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12755,7 +12755,9 @@ qemuDomainSnapshotPrepare(virConnectPtr conn, /* For now, we don't allow mixing internal and external disks. * XXX technically, we could mix internal and external disks for * offline snapshots */ - if (found_internal && external) { + if ((found_internal && external) || + (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && external) || + (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL && found_internal)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("mixing internal and external targets for a snapshot " "is not yet supported")); -- GitLab