thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 0567c3f91a89c476b29341e581aac0e522d26717 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Sun, 19 Jan 2014 18:08:00 +0100
9ae3a8
Subject: [PATCH 26/34] block/drive-mirror: Reuse backing HD for sync=none
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1390154881-17140-7-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 56819
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 6/7] block/drive-mirror: Reuse backing HD for sync=none
9ae3a8
Bugzilla: 921890
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
9ae3a8
BZ: 921890
9ae3a8
9ae3a8
For "none" sync mode in "absolute-paths" mode, the current image should
9ae3a8
be used as the backing file for the newly created image.
9ae3a8
9ae3a8
The current behavior is:
9ae3a8
a) If the image to be mirrored has a backing file, use that (which is
9ae3a8
   wrong, since the operations recorded by "none" are applied to the
9ae3a8
   image itself, not to its backing file).
9ae3a8
b) If the image to be mirrored lacks a backing file, the target doesn't
9ae3a8
   have one either (which is not really wrong, but not really right,
9ae3a8
   either; "none" records a set of operations executed on the image
9ae3a8
   file, therefore having no backing file to apply these operations on
9ae3a8
   seems rather pointless).
9ae3a8
9ae3a8
For a, this is clearly a bugfix. For b, it is still a bugfix, although
9ae3a8
it might break existing API - but since that case crashed qemu just
9ae3a8
three weeks ago (before 1452686495922b81d6cf43edf025c1aef15965c0), we
9ae3a8
can safely assume there is no such API relying on that case yet.
9ae3a8
9ae3a8
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Message-id: 1385407736-13941-2-git-send-email-mreitz@redhat.com
9ae3a8
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
9ae3a8
(cherry picked from commit 117e0c82881f05d88902d4059a3171bc6cd02df0)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 blockdev.c | 3 +++
9ae3a8
 1 file changed, 3 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 blockdev.c |    3 +++
9ae3a8
 1 files changed, 3 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/blockdev.c b/blockdev.c
9ae3a8
index 06bbf30..80c6bb4 100644
9ae3a8
--- a/blockdev.c
9ae3a8
+++ b/blockdev.c
9ae3a8
@@ -1604,6 +1604,9 @@ void qmp_drive_mirror(const char *device, const char *target,
9ae3a8
     if (!source && sync == MIRROR_SYNC_MODE_TOP) {
9ae3a8
         sync = MIRROR_SYNC_MODE_FULL;
9ae3a8
     }
9ae3a8
+    if (sync == MIRROR_SYNC_MODE_NONE) {
9ae3a8
+        source = bs;
9ae3a8
+    }
9ae3a8
 
9ae3a8
     size = bdrv_getlength(bs);
9ae3a8
     if (size < 0) {
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8