From e813a5e84a4100278276b4202577a8b12c6ae891 Mon Sep 17 00:00:00 2001 Message-Id: From: Peter Krempa Date: Wed, 26 Feb 2014 14:55:10 +0100 Subject: [PATCH] qemu: snapshot: Fix incorrect disk type for auto-generated disks https://bugzilla.redhat.com/show_bug.cgi?id=1032370 When changing the parsing and formatting functions in commit 43f2ccdc73090bd03f64de4d58d46ffa0134d705 I forgot to update the qemu disk alignment function for snapshots that automatically adds snapshot configs for disks that were not mentioned in the XML. The function allocated a new disk snapshot definition but did not correctly initialize the snapshot disk source type variable. This resulted into the disks considered as block devices and invalid XML was generated. Reported by John Ferlan. (cherry picked from commit dafdea74b06655c1bf44d06ba040f85b8743164b) Signed-off-by: Jiri Denemark --- src/conf/snapshot_conf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index a1fd723..3a7ed5d 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -495,6 +495,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, goto cleanup; disk->index = i; disk->snapshot = def->dom->disks[i]->snapshot; + disk->type = -1; if (!disk->snapshot) disk->snapshot = default_snapshot; } @@ -512,6 +513,15 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, const char *tmp; struct stat sb; + if (disk->type != VIR_DOMAIN_DISK_TYPE_FILE && + disk->type != -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot generate external snapshot name " + "for disk '%s' on a '%s' device"), + disk->name, virDomainDiskTypeToString(disk->type)); + goto cleanup; + } + if (!original) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot generate external snapshot name " -- 1.9.0