summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2014-06-25 18:11:17 +0200
committerEric Blake <eblake@redhat.com>2014-06-26 18:10:59 -0600
commit6cb267e816fd89e0c362d5a090ec6c0539d5e730 (patch)
treec53cbb534e9c2ab0576b9eecee706e7bba307bbc
parent8ff53ba99124a1910541fd200ddff23fe972a5fe (diff)
downloadlibvirt-6cb267e816fd89e0c362d5a090ec6c0539d5e730.tar.gz
qemu: blockcopy: Don't remove existing disk mirror info
When creating a new disk mirror the new struct is stored in a separate variable until everything went well. The removed hunk would actually remove existing mirror information for example when the api would be run if a mirror still exists. (cherry picked from commit 02b364e186d487f54ed410c01af042f23e812d42) This fixes a regression introduced in commit ff5f30b. Signed-off-by: Eric Blake <eblake@redhat.com> Conflicts: src/qemu/qemu_driver.c - no refactoring of commits 7b7bf001, 4f20226, a88fb30, 632f78c Conflicts: src/qemu/qemu_driver.c
-rw-r--r--src/qemu/qemu_driver.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 723f67b632..ff858d3b2c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13425,6 +13425,7 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
struct stat st;
bool need_unlink = false;
char *mirror = NULL;
+ int mirrorFormat;
virCgroupPtr cgroup = NULL;
virQEMUDriverConfigPtr cfg = NULL;
@@ -13522,10 +13523,10 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
goto endjob;
VIR_FORCE_CLOSE(fd);
if (!format)
- disk->mirrorFormat = disk->format;
+ mirrorFormat = disk->format;
} else if (format) {
- disk->mirrorFormat = virStorageFileFormatTypeFromString(format);
- if (disk->mirrorFormat <= 0) {
+ mirrorFormat = virStorageFileFormatTypeFromString(format);
+ if (mirrorFormat <= 0) {
virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
format);
goto endjob;
@@ -13535,11 +13536,11 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
* also passed the RAW flag (and format is non-NULL), or it is
* safe for us to probe the format from the file that we will
* be using. */
- disk->mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
- cfg->group);
+ mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
+ cfg->group);
}
- if (!format && disk->mirrorFormat > 0)
- format = virStorageFileFormatTypeToString(disk->mirrorFormat);
+ if (!format && mirrorFormat > 0)
+ format = virStorageFileFormatTypeToString(mirrorFormat);
if (!(mirror = strdup(dest))) {
virReportOOMError();
goto endjob;
@@ -13567,13 +13568,12 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
/* Update vm in place to match changes. */
need_unlink = false;
disk->mirror = mirror;
+ disk->mirrorFormat = mirrorFormat;
mirror = NULL;
endjob:
if (need_unlink && unlink(dest))
VIR_WARN("unable to unlink just-created %s", dest);
- if (ret < 0 && disk)
- disk->mirrorFormat = VIR_STORAGE_FILE_NONE;
VIR_FREE(mirror);
if (qemuDomainObjEndJob(driver, vm) == 0) {
vm = NULL;