qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] mirror: prevent 'top' mode mirroring when no backin


From: sochin jiang
Subject: [Qemu-devel] [PATCH] mirror: prevent 'top' mode mirroring when no backing file specified on the destination
Date: Tue, 20 Dec 2016 06:38:26 +0800

 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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]