qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/7] migrate: add migration blockers
@ 2011-11-12 15:56 Anthony Liguori
  2011-11-12 15:56 ` [Qemu-devel] [PATCH 2/7] ivshmem: use migration blockers to prevent live migration in peer mode Anthony Liguori
                   ` (8 more replies)
  0 siblings, 9 replies; 27+ messages in thread
From: Anthony Liguori @ 2011-11-12 15:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Lucas Meneghel Rodrigues, Anthony Liguori,
	Stefan Hajnoczi, Juan Quintela, Avi Kivity

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>
---
 migration.c |   18 ++++++++++++++++++
 migration.h |   15 +++++++++++++++
 2 files changed, 33 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)) {
diff --git a/migration.h b/migration.h
index 1b8ee58..0682179 100644
--- a/migration.h
+++ b/migration.h
@@ -17,6 +17,7 @@
 #include "qdict.h"
 #include "qemu-common.h"
 #include "notify.h"
+#include "error.h"
 
 typedef struct MigrationState MigrationState;
 
@@ -89,4 +90,18 @@ int ram_load(QEMUFile *f, void *opaque, int version_id);
 
 extern int incoming_expected;
 
+/**
+ * @migrate_add_blocker - prevent migration from proceeding
+ *
+ * @reason - an error to be returned whenever migration is attempted
+ */
+void migrate_add_blocker(Error *reason);
+
+/**
+ * @migrate_del_blocker - remove a blocking error from migration
+ *
+ * @reason - the error blocking migration
+ */
+void migrate_del_blocker(Error *reason);
+
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 27+ messages in thread
* [Qemu-devel] [PATCH 1/7] migrate: add migration blockers
@ 2011-11-12 15:57 Anthony Liguori
  2011-11-12 15:57 ` [Qemu-devel] [PATCH 2/7] ivshmem: use migration blockers to prevent live migration in peer mode Anthony Liguori
  0 siblings, 1 reply; 27+ messages in thread
From: Anthony Liguori @ 2011-11-12 15:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Lucas Meneghel Rodrigues, Anthony Liguori,
	Stefan Hajnoczi, Juan Quintela, Avi Kivity

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>
---
 migration.c |   18 ++++++++++++++++++
 migration.h |   15 +++++++++++++++
 2 files changed, 33 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)) {
diff --git a/migration.h b/migration.h
index 1b8ee58..0682179 100644
--- a/migration.h
+++ b/migration.h
@@ -17,6 +17,7 @@
 #include "qdict.h"
 #include "qemu-common.h"
 #include "notify.h"
+#include "error.h"
 
 typedef struct MigrationState MigrationState;
 
@@ -89,4 +90,18 @@ int ram_load(QEMUFile *f, void *opaque, int version_id);
 
 extern int incoming_expected;
 
+/**
+ * @migrate_add_blocker - prevent migration from proceeding
+ *
+ * @reason - an error to be returned whenever migration is attempted
+ */
+void migrate_add_blocker(Error *reason);
+
+/**
+ * @migrate_del_blocker - remove a blocking error from migration
+ *
+ * @reason - the error blocking migration
+ */
+void migrate_del_blocker(Error *reason);
+
 #endif
-- 
1.7.4.1

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

end of thread, other threads:[~2011-11-14 20:49 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-12 15:56 [Qemu-devel] [PATCH 1/7] migrate: add migration blockers Anthony Liguori
2011-11-12 15:56 ` [Qemu-devel] [PATCH 2/7] ivshmem: use migration blockers to prevent live migration in peer mode Anthony Liguori
2011-11-14 13:05   ` Juan Quintela
2011-11-14 13:52     ` Anthony Liguori
2011-11-14 19:52       ` Juan Quintela
2011-11-14 19:55         ` Anthony Liguori
2011-11-12 15:56 ` [Qemu-devel] [PATCH 3/7] qcow2: add a migration blocker Anthony Liguori
2011-11-12 15:56 ` [Qemu-devel] [PATCH 4/7] qed: add " Anthony Liguori
2011-11-12 15:56 ` [Qemu-devel] [PATCH 5/7] block: allow migration to work with image files (v2) Anthony Liguori
2011-11-14 13:11   ` Juan Quintela
2011-11-14 14:10     ` Anthony Liguori
2011-11-14 19:46       ` Juan Quintela
2011-11-14 19:49         ` Anthony Liguori
2011-11-14 20:11           ` Kevin Wolf
2011-11-14 20:12             ` Anthony Liguori
2011-11-14 20:28               ` Juan Quintela
2011-11-14 20:36               ` Kevin Wolf
2011-11-14 20:49                 ` Anthony Liguori
2011-11-14 20:15             ` Juan Quintela
2011-11-12 15:56 ` [Qemu-devel] [PATCH 6/7] qcow2: implement bdrv_invalidate_cache Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 7/7] qcow2: relax migration blocker Anthony Liguori
2011-11-14  9:04   ` Kevin Wolf
2011-11-14  9:08 ` [Qemu-devel] [PATCH 1/7] migrate: add migration blockers Kevin Wolf
2011-11-14 18:25   ` Anthony Liguori
2011-11-14  9:12 ` Kevin Wolf
2011-11-14 13:00 ` Juan Quintela
  -- strict thread matches above, loose matches on Subject: below --
2011-11-12 15:57 Anthony Liguori
2011-11-12 15:57 ` [Qemu-devel] [PATCH 2/7] ivshmem: use migration blockers to prevent live migration in peer mode Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).