cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-drive-mirror-Reuse-backing-HD-for-sync-none.patch

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