qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] mirror: prevent 'top' mode mirroring when no backing file specified on the destination
@ 2016-12-19 22:38 sochin jiang
  2016-12-19 15:31 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: sochin jiang @ 2016-12-19 22:38 UTC (permalink / raw)
  To: jcody, kwolf, mreitz
  Cc: qemu-block, qemu-devel, sochin.jiang, xieyingtai, eric.fangyi,
	subo7, wangjie88

 Mirroring using 'top' mode without backing file specified on the target can be success,
 but end with a disaster.

 For example:
   Migration can be success in this situation while the virtual machine on the destination
 is no longer usable because of backing lost.

 Remind the user earlier and return error in case of misoperation.

Signed-off-by: sochin jiang <sochin.jiang@huawei.com>
---
 block/mirror.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/mirror.c b/block/mirror.c
index 301ba92..3476696 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1038,6 +1038,12 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
         error_setg(errp, "Sync mode 'incremental' not supported");
         return;
     }
+    if (mode == MIRROR_SYNC_MODE_TOP && !backing_bs(target))
+    {
+        error_setg(errp, "Target Backing required using Sync mode 'top'");
+        return;
+    }
+
     is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
     base = mode == MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL;
     mirror_start_job(job_id, bs, BLOCK_JOB_DEFAULT, target, replaces,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-20 23:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 22:38 [Qemu-devel] [PATCH] mirror: prevent 'top' mode mirroring when no backing file specified on the destination sochin jiang
2016-12-19 15:31 ` Eric Blake
2016-12-20  0:41   ` sochin.jiang
2016-12-19 15:31 ` Max Reitz
2016-12-20  0:44   ` sochin.jiang
2016-12-20 23:03 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).