|
|
44539d |
From 8b3fc29cdc829d0808c54cfa0936991a74f06aaf Mon Sep 17 00:00:00 2001
|
|
|
44539d |
Message-Id: <8b3fc29cdc829d0808c54cfa0936991a74f06aaf@dist-git>
|
|
|
44539d |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
44539d |
Date: Wed, 1 Oct 2014 17:41:58 -0600
|
|
|
44539d |
Subject: [PATCH] qemu: blockcopy: Don't remove existing disk mirror info
|
|
|
44539d |
|
|
|
44539d |
RHEL 7.0.z: https://bugzilla.redhat.com/show_bug.cgi?id=1149078
|
|
|
44539d |
RHEL 7.1: https://bugzilla.redhat.com/show_bug.cgi?id=1113751
|
|
|
44539d |
|
|
|
44539d |
When creating a new disk mirror the new struct is stored in a separate
|
|
|
44539d |
variable until everything went well. The removed hunk would actually
|
|
|
44539d |
remove existing mirror information for example when the api would be run
|
|
|
44539d |
if a mirror still exists.
|
|
|
44539d |
|
|
|
44539d |
(cherry picked from commit 02b364e186d487f54ed410c01af042f23e812d42)
|
|
|
44539d |
|
|
|
44539d |
This fixes a regression introduced in commit ff5f30b.
|
|
|
44539d |
|
|
|
44539d |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
44539d |
|
|
|
44539d |
Conflicts:
|
|
|
44539d |
src/qemu/qemu_driver.c - no refactoring of commits 7b7bf001, 4f20226
|
|
|
44539d |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
44539d |
---
|
|
|
44539d |
src/qemu/qemu_driver.c | 18 +++++++++---------
|
|
|
44539d |
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
44539d |
|
|
|
44539d |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
44539d |
index ebdbfd7..ea87d50 100644
|
|
|
44539d |
--- a/src/qemu/qemu_driver.c
|
|
|
44539d |
+++ b/src/qemu/qemu_driver.c
|
|
|
44539d |
@@ -15037,6 +15037,7 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
|
|
44539d |
struct stat st;
|
|
|
44539d |
bool need_unlink = false;
|
|
|
44539d |
char *mirror = NULL;
|
|
|
44539d |
+ int mirrorFormat;
|
|
|
44539d |
virQEMUDriverConfigPtr cfg = NULL;
|
|
|
44539d |
|
|
|
44539d |
/* Preliminaries: find the disk we are editing, sanity checks */
|
|
|
44539d |
@@ -15124,10 +15125,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
|
|
44539d |
goto endjob;
|
|
|
44539d |
VIR_FORCE_CLOSE(fd);
|
|
|
44539d |
if (!format)
|
|
|
44539d |
- disk->mirrorFormat = disk->format;
|
|
|
44539d |
+ mirrorFormat = disk->format;
|
|
|
44539d |
} else if (format) {
|
|
|
44539d |
- disk->mirrorFormat = virStorageFileFormatTypeFromString(format);
|
|
|
44539d |
- if (disk->mirrorFormat <= 0) {
|
|
|
44539d |
+ mirrorFormat = virStorageFileFormatTypeFromString(format);
|
|
|
44539d |
+ if (mirrorFormat <= 0) {
|
|
|
44539d |
virReportError(VIR_ERR_INVALID_ARG, _("unrecognized format '%s'"),
|
|
|
44539d |
format);
|
|
|
44539d |
goto endjob;
|
|
|
44539d |
@@ -15137,11 +15138,11 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
|
|
44539d |
* also passed the RAW flag (and format is non-NULL), or it is
|
|
|
44539d |
* safe for us to probe the format from the file that we will
|
|
|
44539d |
* be using. */
|
|
|
44539d |
- disk->mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
|
|
|
44539d |
- cfg->group);
|
|
|
44539d |
+ mirrorFormat = virStorageFileProbeFormat(dest, cfg->user,
|
|
|
44539d |
+ cfg->group);
|
|
|
44539d |
}
|
|
|
44539d |
- if (!format && disk->mirrorFormat > 0)
|
|
|
44539d |
- format = virStorageFileFormatTypeToString(disk->mirrorFormat);
|
|
|
44539d |
+ if (!format && mirrorFormat > 0)
|
|
|
44539d |
+ format = virStorageFileFormatTypeToString(mirrorFormat);
|
|
|
44539d |
if (VIR_STRDUP(mirror, dest) < 0)
|
|
|
44539d |
goto endjob;
|
|
|
44539d |
|
|
|
44539d |
@@ -15167,13 +15168,12 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
|
|
44539d |
/* Update vm in place to match changes. */
|
|
|
44539d |
need_unlink = false;
|
|
|
44539d |
disk->mirror = mirror;
|
|
|
44539d |
+ disk->mirrorFormat = mirrorFormat;
|
|
|
44539d |
mirror = NULL;
|
|
|
44539d |
|
|
|
44539d |
endjob:
|
|
|
44539d |
if (need_unlink && unlink(dest))
|
|
|
44539d |
VIR_WARN("unable to unlink just-created %s", dest);
|
|
|
44539d |
- if (ret < 0 && disk)
|
|
|
44539d |
- disk->mirrorFormat = VIR_STORAGE_FILE_NONE;
|
|
|
44539d |
VIR_FREE(mirror);
|
|
|
44539d |
if (qemuDomainObjEndJob(driver, vm) == 0) {
|
|
|
44539d |
vm = NULL;
|
|
|
44539d |
--
|
|
|
44539d |
2.2.0
|
|
|
44539d |
|