aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-11-14 15:09:47 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-21 14:58:48 -0600
commit1ed520c66e3f3b57b88d201c08558ec1616bf69d (patch)
tree806c590f41a6872f17dcdde827e7632aead4bd7a
parent06d9260ffa9dfa0e96e015501e43480ab66f96f6 (diff)
qed: add migration blocker (v2)
Now when you try to migrate with qed, you get: (qemu) migrate tcp:localhost:1025 Block format 'qed' used by device 'ide0-hd0' does not support feature 'live migration' (qemu) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--block/qed.c10
-rw-r--r--block/qed.h2
-rw-r--r--qemu-tool.c9
-rw-r--r--qerror.c4
-rw-r--r--qerror.h3
5 files changed, 28 insertions, 0 deletions
diff --git a/block/qed.c b/block/qed.c
index d032a4574c..7e22e77b9d 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -16,6 +16,7 @@
#include "trace.h"
#include "qed.h"
#include "qerror.h"
+#include "migration.h"
static void qed_aio_cancel(BlockDriverAIOCB *blockacb)
{
@@ -504,6 +505,12 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
s->need_check_timer = qemu_new_timer_ns(vm_clock,
qed_need_check_timer_cb, s);
+ error_set(&s->migration_blocker,
+ QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
+ "qed", bs->device_name, "live migration");
+ migrate_add_blocker(s->migration_blocker);
+
+
out:
if (ret) {
qed_free_l2_cache(&s->l2_cache);
@@ -516,6 +523,9 @@ static void bdrv_qed_close(BlockDriverState *bs)
{
BDRVQEDState *s = bs->opaque;
+ migrate_del_blocker(s->migration_blocker);
+ error_free(s->migration_blocker);
+
qed_cancel_need_check_timer(s);
qemu_free_timer(s->need_check_timer);
diff --git a/block/qed.h b/block/qed.h
index 388fdb3760..62cbd3b899 100644
--- a/block/qed.h
+++ b/block/qed.h
@@ -164,6 +164,8 @@ typedef struct {
/* Periodic flush and clear need check flag */
QEMUTimer *need_check_timer;
+
+ Error *migration_blocker;
} BDRVQEDState;
enum {
diff --git a/qemu-tool.c b/qemu-tool.c
index e9f7fe1e1a..5df7279745 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -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)
+{
+}
diff --git a/qerror.c b/qerror.c
index 8e30e2dc1e..fdf62b9e27 100644
--- a/qerror.c
+++ b/qerror.c
@@ -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",
},
diff --git a/qerror.h b/qerror.h
index 7e2eebf983..2d3d43bed1 100644
--- a/qerror.h
+++ b/qerror.h
@@ -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 } }"