aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-11-14 15:09:43 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-21 14:57:22 -0600
commitfa2756b71b73e8cd94f7d8964ad5e2aca4d2691c (patch)
treebb9ed751b926fdc4577213cf95ddb52a45480e56 /migration.c
parenta3baf1be673221752c82015b4b9157f23dfc6fd6 (diff)
downloadqemu-fa2756b71b73e8cd94f7d8964ad5e2aca4d2691c.zip
qemu-fa2756b71b73e8cd94f7d8964ad5e2aca4d2691c.tar.gz
qemu-fa2756b71b73e8cd94f7d8964ad5e2aca4d2691c.tar.bz2
migrate: add migration blockers
This lets different subsystems register an Error that is thrown whenever migration is attempted. This works nicely because it gracefully supports things like hotplug. Right now, if multiple errors are registered, only one of them is reported. I expect that for 1.1, we'll extend query-migrate to return all of the reasons why migration is disabled at any given point in time. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/migration.c b/migration.c
index 41c3c24..6764d3a 100644
--- a/migration.c
+++ b/migration.c
@@ -398,6 +398,18 @@ static MigrationState *migrate_init(Monitor *mon, int detach, int blk, int inc)
return s;
}
+static GSList *migration_blockers;
+
+void migrate_add_blocker(Error *reason)
+{
+ migration_blockers = g_slist_prepend(migration_blockers, reason);
+}
+
+void migrate_del_blocker(Error *reason)
+{
+ migration_blockers = g_slist_remove(migration_blockers, reason);
+}
+
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
MigrationState *s = migrate_get_current();
@@ -417,6 +429,12 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
return -1;
}
+ if (migration_blockers) {
+ Error *err = migration_blockers->data;
+ qerror_report_err(err);
+ return -1;
+ }
+
s = migrate_init(mon, detach, blk, inc);
if (strstart(uri, "tcp:", &p)) {