Patchwork [7/7] qcow2: relax migration blocker

login
register
mail settings
Submitter Anthony Liguori
Date Nov. 12, 2011, 3:57 p.m.
Message ID <1321113459-3331-7-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/125359/
State New
Headers show

Comments

Anthony Liguori - Nov. 12, 2011, 3:57 p.m.
Only block migration if we're using encrypted files.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 block/qcow2.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index b5171e0..8071f2c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -279,10 +279,12 @@  static int qcow2_open(BlockDriverState *bs, int flags)
         goto fail;
     }
 
-    error_set(&s->migration_blocker,
-              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
-              "qcow2", bs->device_name, "live migration");
-    migrate_add_blocker(s->migration_blocker);
+    if (bs->encrypted) {
+        error_set(&s->migration_blocker,
+                  QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+                  "qcow2", bs->device_name, "live migration");
+        migrate_add_blocker(s->migration_blocker);
+    }
 
     /* Initialise locks */
     qemu_co_mutex_init(&s->lock);
@@ -628,8 +630,10 @@  static void qcow2_close(BlockDriverState *bs)
     BDRVQcowState *s = bs->opaque;
     g_free(s->l1_table);
 
-    migrate_del_blocker(s->migration_blocker);
-    error_free(s->migration_blocker);
+    if (s->migration_blocker) {
+        migrate_del_blocker(s->migration_blocker);
+        error_free(s->migration_blocker);
+    }
 
     qcow2_cache_flush(bs, s->l2_table_cache);
     qcow2_cache_flush(bs, s->refcount_block_cache);