All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] block: More migration blockers
@ 2011-11-22 16:14 Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 1/5] qcow: Add migration blocker Kevin Wolf
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

Not only QED is unsafe with respect to migration, almost all other writable
image formats are as well. Let's add migration blockers there.

Kevin Wolf (5):
  qcow: Add migration blocker
  vdi: Add migration blocker
  vmdk: Add migration blocker
  vpc: Add migration blocker
  vvfat: Add migration blocker

 block/qcow.c  |   12 ++++++++++++
 block/vdi.c   |   12 ++++++++++++
 block/vmdk.c  |   16 +++++++++++++++-
 block/vpc.c   |   13 +++++++++++++
 block/vvfat.c |   17 +++++++++++++++++
 5 files changed, 69 insertions(+), 1 deletions(-)

-- 
1.7.6.4

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

* [Qemu-devel] [PATCH 1/5] qcow: Add migration blocker
  2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
@ 2011-11-22 16:14 ` Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 2/5] vdi: " Kevin Wolf
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

qcow caches L2 tables. For migration to work, they would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/block/qcow.c b/block/qcow.c
index 5314697..326ef87 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -26,6 +26,7 @@
 #include "module.h"
 #include <zlib.h>
 #include "aes.h"
+#include "migration.h"
 
 /**************************************************************/
 /* QEMU COW block driver with compression and encryption support */
@@ -74,6 +75,7 @@ typedef struct BDRVQcowState {
     AES_KEY aes_encrypt_key;
     AES_KEY aes_decrypt_key;
     CoMutex lock;
+    Error *migration_blocker;
 } BDRVQcowState;
 
 static int decompress_cluster(BlockDriverState *bs, uint64_t cluster_offset);
@@ -160,6 +162,12 @@ static int qcow_open(BlockDriverState *bs, int flags)
         bs->backing_file[len] = '\0';
     }
 
+    /* Disable migration when qcow images are used */
+    error_set(&s->migration_blocker,
+              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+              "qcow", bs->device_name, "live migration");
+    migrate_add_blocker(s->migration_blocker);
+
     qemu_co_mutex_init(&s->lock);
     return 0;
 
@@ -604,10 +612,14 @@ static coroutine_fn int qcow_co_writev(BlockDriverState *bs, int64_t sector_num,
 static void qcow_close(BlockDriverState *bs)
 {
     BDRVQcowState *s = bs->opaque;
+
     g_free(s->l1_table);
     g_free(s->l2_cache);
     g_free(s->cluster_cache);
     g_free(s->cluster_data);
+
+    migrate_del_blocker(s->migration_blocker);
+    error_free(s->migration_blocker);
 }
 
 static int qcow_create(const char *filename, QEMUOptionParameter *options)
-- 
1.7.6.4

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

* [Qemu-devel] [PATCH 2/5] vdi: Add migration blocker
  2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 1/5] qcow: Add migration blocker Kevin Wolf
@ 2011-11-22 16:14 ` Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 3/5] vmdk: " Kevin Wolf
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

vdi caches the block map. For migration to work, it would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vdi.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/block/vdi.c b/block/vdi.c
index 684a4a8..7dda522 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -52,6 +52,7 @@
 #include "qemu-common.h"
 #include "block_int.h"
 #include "module.h"
+#include "migration.h"
 
 #if defined(CONFIG_UUID)
 #include <uuid/uuid.h>
@@ -203,6 +204,8 @@ typedef struct {
     uint32_t bmap_sector;
     /* VDI header (converted to host endianness). */
     VdiHeader header;
+
+    Error *migration_blocker;
 } BDRVVdiState;
 
 /* Change UUID from little endian (IPRT = VirtualBox format) to big endian
@@ -454,6 +457,12 @@ static int vdi_open(BlockDriverState *bs, int flags)
         goto fail_free_bmap;
     }
 
+    /* Disable migration when vdi images are used */
+    error_set(&s->migration_blocker,
+              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+              "vdi", bs->device_name, "live migration");
+    migrate_add_blocker(s->migration_blocker);
+
     return 0;
 
  fail_free_bmap:
@@ -939,6 +948,9 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options)
 
 static void vdi_close(BlockDriverState *bs)
 {
+    BDRVVdiState *s = bs->opaque;
+    migrate_del_blocker(s->migration_blocker);
+    error_free(s->migration_blocker);
 }
 
 static coroutine_fn int vdi_co_flush(BlockDriverState *bs)
-- 
1.7.6.4

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

* [Qemu-devel] [PATCH 3/5] vmdk: Add migration blocker
  2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 1/5] qcow: Add migration blocker Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 2/5] vdi: " Kevin Wolf
@ 2011-11-22 16:14 ` Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 4/5] vpc: " Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 5/5] vvfat: " Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

VMDK caches L2 tables. For migration to work, they would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vmdk.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index 96f7d5d..f544159 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -26,6 +26,7 @@
 #include "qemu-common.h"
 #include "block_int.h"
 #include "module.h"
+#include "migration.h"
 #include <zlib.h>
 
 #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D')
@@ -97,6 +98,7 @@ typedef struct BDRVVmdkState {
     int num_extents;
     /* Extent array with num_extents entries, ascend ordered by address */
     VmdkExtent *extents;
+    Error *migration_blocker;
 } BDRVVmdkState;
 
 typedef struct VmdkMetaData {
@@ -659,7 +661,14 @@ static int vmdk_open(BlockDriverState *bs, int flags)
     }
     s->parent_cid = vmdk_read_cid(bs, 1);
     qemu_co_mutex_init(&s->lock);
-    return ret;
+
+    /* Disable migration when VMDK images are used */
+    error_set(&s->migration_blocker,
+              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+              "vmdk", bs->device_name, "live migration");
+    migrate_add_blocker(s->migration_blocker);
+
+    return 0;
 
 fail:
     vmdk_free_extents(bs);
@@ -1504,7 +1513,12 @@ exit:
 
 static void vmdk_close(BlockDriverState *bs)
 {
+    BDRVVmdkState *s = bs->opaque;
+
     vmdk_free_extents(bs);
+
+    migrate_del_blocker(s->migration_blocker);
+    error_free(s->migration_blocker);
 }
 
 static coroutine_fn int vmdk_co_flush(BlockDriverState *bs)
-- 
1.7.6.4

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

* [Qemu-devel] [PATCH 4/5] vpc: Add migration blocker
  2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
                   ` (2 preceding siblings ...)
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 3/5] vmdk: " Kevin Wolf
@ 2011-11-22 16:14 ` Kevin Wolf
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 5/5] vvfat: " Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

vpc caches the BAT. For migration to work, it would have to be
invalidated. Block migration for now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vpc.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/block/vpc.c b/block/vpc.c
index 39a3247..75d7d4a 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -25,6 +25,7 @@
 #include "qemu-common.h"
 #include "block_int.h"
 #include "module.h"
+#include "migration.h"
 
 /**************************************************************/
 
@@ -128,6 +129,8 @@ typedef struct BDRVVPCState {
 
     uint64_t last_bitmap;
 #endif
+
+    Error *migration_blocker;
 } BDRVVPCState;
 
 static uint32_t vpc_checksum(uint8_t* buf, size_t size)
@@ -228,6 +231,13 @@ static int vpc_open(BlockDriverState *bs, int flags)
 #endif
 
     qemu_co_mutex_init(&s->lock);
+
+    /* Disable migration when VHD images are used */
+    error_set(&s->migration_blocker,
+              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+              "vpc", bs->device_name, "live migration");
+    migrate_add_blocker(s->migration_blocker);
+
     return 0;
  fail:
     return err;
@@ -651,6 +661,9 @@ static void vpc_close(BlockDriverState *bs)
 #ifdef CACHE
     g_free(s->pageentry_u8);
 #endif
+
+    migrate_del_blocker(s->migration_blocker);
+    error_free(s->migration_blocker);
 }
 
 static QEMUOptionParameter vpc_create_options[] = {
-- 
1.7.6.4

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

* [Qemu-devel] [PATCH 5/5] vvfat: Add migration blocker
  2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
                   ` (3 preceding siblings ...)
  2011-11-22 16:14 ` [Qemu-devel] [PATCH 4/5] vpc: " Kevin Wolf
@ 2011-11-22 16:14 ` Kevin Wolf
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2011-11-22 16:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

vvfat caches more or less everything when in writable mode. For migration
to work, it would have to be invalidated. Block migration for now when
in writable mode (default is readonly).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/vvfat.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index 131680f..a310ce8 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "block_int.h"
 #include "module.h"
+#include "migration.h"
 
 #ifndef S_IWGRP
 #define S_IWGRP 0
@@ -350,6 +351,8 @@ typedef struct BDRVVVFATState {
     array_t commits;
     const char* path;
     int downcase_short_names;
+
+    Error *migration_blocker;
 } BDRVVVFATState;
 
 /* take the sector position spos and convert it to Cylinder/Head/Sector position
@@ -1073,6 +1076,15 @@ DLOG(if (stderr == NULL) {
 
     //    assert(is_consistent(s));
     qemu_co_mutex_init(&s->lock);
+
+    /* Disable migration when vvfat is used rw */
+    if (s->qcow) {
+        error_set(&s->migration_blocker,
+                  QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+                  "vvfat (rw)", bs->device_name, "live migration");
+        migrate_add_blocker(s->migration_blocker);
+    }
+
     return 0;
 }
 
@@ -2829,6 +2841,11 @@ static void vvfat_close(BlockDriverState *bs)
     array_free(&(s->directory));
     array_free(&(s->mapping));
     g_free(s->cluster_buffer);
+
+    if (s->qcow) {
+        migrate_del_blocker(s->migration_blocker);
+        error_free(s->migration_blocker);
+    }
 }
 
 static BlockDriver bdrv_vvfat = {
-- 
1.7.6.4

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

end of thread, other threads:[~2011-11-22 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 16:14 [Qemu-devel] [PATCH 0/5] block: More migration blockers Kevin Wolf
2011-11-22 16:14 ` [Qemu-devel] [PATCH 1/5] qcow: Add migration blocker Kevin Wolf
2011-11-22 16:14 ` [Qemu-devel] [PATCH 2/5] vdi: " Kevin Wolf
2011-11-22 16:14 ` [Qemu-devel] [PATCH 3/5] vmdk: " Kevin Wolf
2011-11-22 16:14 ` [Qemu-devel] [PATCH 4/5] vpc: " Kevin Wolf
2011-11-22 16:14 ` [Qemu-devel] [PATCH 5/5] vvfat: " Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.