vmdk: Add migration blocker

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>
This commit is contained in:
Kevin Wolf 2011-11-22 16:50:27 +01:00
parent fc9d106c8d
commit 2bc3166c22

View File

@ -26,6 +26,7 @@
#include "qemu-common.h" #include "qemu-common.h"
#include "block_int.h" #include "block_int.h"
#include "module.h" #include "module.h"
#include "migration.h"
#include <zlib.h> #include <zlib.h>
#define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D') #define VMDK3_MAGIC (('C' << 24) | ('O' << 16) | ('W' << 8) | 'D')
@ -97,6 +98,7 @@ typedef struct BDRVVmdkState {
int num_extents; int num_extents;
/* Extent array with num_extents entries, ascend ordered by address */ /* Extent array with num_extents entries, ascend ordered by address */
VmdkExtent *extents; VmdkExtent *extents;
Error *migration_blocker;
} BDRVVmdkState; } BDRVVmdkState;
typedef struct VmdkMetaData { typedef struct VmdkMetaData {
@ -659,7 +661,14 @@ static int vmdk_open(BlockDriverState *bs, int flags)
} }
s->parent_cid = vmdk_read_cid(bs, 1); s->parent_cid = vmdk_read_cid(bs, 1);
qemu_co_mutex_init(&s->lock); 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: fail:
vmdk_free_extents(bs); vmdk_free_extents(bs);
@ -1504,7 +1513,12 @@ exit:
static void vmdk_close(BlockDriverState *bs) static void vmdk_close(BlockDriverState *bs)
{ {
BDRVVmdkState *s = bs->opaque;
vmdk_free_extents(bs); vmdk_free_extents(bs);
migrate_del_blocker(s->migration_blocker);
error_free(s->migration_blocker);
} }
static coroutine_fn int vmdk_co_flush(BlockDriverState *bs) static coroutine_fn int vmdk_co_flush(BlockDriverState *bs)