@@ -29,6 +29,7 @@
#include "block/qcow2.h"
#include "qemu-error.h"
#include "qerror.h"
+#include "migration.h"
/*
Differences with QCOW:
@@ -277,6 +278,11 @@ 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);
+
/* Initialise locks */
qemu_co_mutex_init(&s->lock);
@@ -621,6 +627,9 @@ 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);
+
qcow2_cache_flush(bs, s->l2_table_cache);
qcow2_cache_flush(bs, s->refcount_block_cache);
@@ -125,6 +125,8 @@ typedef struct BDRVQcowState {
int snapshots_size;
int nb_snapshots;
QCowSnapshot *snapshots;
+
+ Error *migration_blocker;
} BDRVQcowState;
/* XXX: use std qcow open function ? */
@@ -15,6 +15,7 @@
#include "monitor.h"
#include "qemu-timer.h"
#include "qemu-log.h"
+#include "migration.h"
#include <sys/time.h>
@@ -92,3 +93,11 @@ int64_t qemu_get_clock_ns(QEMUClock *clock)
{
return 0;
}
+
+void migrate_add_blocker(Error *reason)
+{
+}
+
+void migrate_del_blocker(Error *reason)
+{
+}
@@ -49,6 +49,10 @@ static const QErrorStringTable qerror_table[] = {
.desc = "Device '%(device)' can't go on a %(bad_bus_type) bus",
},
{
+ .error_fmt = QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+ .desc = "Block format '%(format)' used by device '%(name)' does not support feature '%(feature)'",
+ },
+ {
.error_fmt = QERR_BUS_NOT_FOUND,
.desc = "Bus '%(bus)' not found",
},
@@ -54,6 +54,9 @@ QError *qobject_to_qerror(const QObject *obj);
#define QERR_BAD_BUS_FOR_DEVICE \
"{ 'class': 'BadBusForDevice', 'data': { 'device': %s, 'bad_bus_type': %s } }"
+#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \
+ "{ 'class': 'BlockFormatFeatureNotSupported', 'data': { 'format': %s, 'name': %s, 'feature': %s } }"
+
#define QERR_BUS_NOT_FOUND \
"{ 'class': 'BusNotFound', 'data': { 'bus': %s } }"
Now when you try to migrate with qcow2, you get: (qemu) migrate tcp:localhost:1025 Block format 'qcow2' used by device 'ide0-hd0' does not support feature 'live migration' (qemu) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- block/qcow2.c | 9 +++++++++ block/qcow2.h | 2 ++ qemu-tool.c | 9 +++++++++ qerror.c | 4 ++++ qerror.h | 3 +++ 5 files changed, 27 insertions(+), 0 deletions(-)