From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSe7O-0000Nx-44 for qemu-devel@nongnu.org; Mon, 21 Nov 2011 19:21:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSe7M-0002xx-Vq for qemu-devel@nongnu.org; Mon, 21 Nov 2011 19:21:46 -0500 Received: from mail-gx0-f173.google.com ([209.85.161.173]:44749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSe7M-0002wN-Im for qemu-devel@nongnu.org; Mon, 21 Nov 2011 19:21:44 -0500 Received: by ggnb1 with SMTP id b1so2127633ggn.4 for ; Mon, 21 Nov 2011 16:21:29 -0800 (PST) Message-ID: <4ECAEB05.5020707@codemonkey.ws> Date: Mon, 21 Nov 2011 18:21:25 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1321304987-23041-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1321304987-23041-1-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/5] migrate: add migration blockers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , Lucas Meneghel Rodrigues , Stefan Hajnoczi , Juan Quintela , qemu-devel@nongnu.org, Avi Kivity On 11/14/2011 03:09 PM, Anthony Liguori wrote: > 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 Applied. Regards, Anthony Liguori > --- > 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