From: Yonit Halperin <yhalperi@redhat.com>
To: qemu-devel@nongnu.org
Cc: Yonit Halperin <yhalperi@redhat.com>,
aliguori@us.ibm.com, alevy@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [RFC PATCH 5/5] spice: turn spice "migration end" handler to be async
Date: Tue, 5 Jun 2012 08:49:46 +0300 [thread overview]
Message-ID: <1338875386-21051-6-git-send-email-yhalperi@redhat.com> (raw)
In-Reply-To: <1338875386-21051-1-git-send-email-yhalperi@redhat.com>
Instead of immediatly calling the notifier completion callback,
the notification handler assigns a completion callback
to spice's migration interface. Spice should call this
callback when it completes handling the migration state change.
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
---
ui/spice-core.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/ui/spice-core.c b/ui/spice-core.c
index d85c212..053f06f 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -282,9 +282,14 @@ typedef struct SpiceMigration {
MonitorCompletion *cb;
void *opaque;
} connect_complete;
+ struct {
+ NotifiedCompletionFunc *cb;
+ void *opaque;
+ } end_complete;
} SpiceMigration;
static void migrate_connect_complete_cb(SpiceMigrateInstance *sin);
+static void migrate_end_complete_cb(SpiceMigrateInstance *sin);
static const SpiceMigrateInterface migrate_interface = {
.base.type = SPICE_INTERFACE_MIGRATION,
@@ -292,7 +297,7 @@ static const SpiceMigrateInterface migrate_interface = {
.base.major_version = SPICE_INTERFACE_MIGRATION_MAJOR,
.base.minor_version = SPICE_INTERFACE_MIGRATION_MINOR,
.migrate_connect_complete = migrate_connect_complete_cb,
- .migrate_end_complete = NULL,
+ .migrate_end_complete = migrate_end_complete_cb,
};
static SpiceMigration spice_migrate;
@@ -305,6 +310,15 @@ static void migrate_connect_complete_cb(SpiceMigrateInstance *sin)
}
sm->connect_complete.cb = NULL;
}
+
+static void migrate_end_complete_cb(SpiceMigrateInstance *sin)
+{
+ SpiceMigration *sm = container_of(sin, SpiceMigration, sin);
+ if (sm->end_complete.cb) {
+ sm->end_complete.cb(&migrate_end_notifier, sm->end_complete.opaque);
+ }
+ sm->end_complete.cb = NULL;
+}
#endif
/* config string parsing */
@@ -492,16 +506,17 @@ static void migrate_end_notify_func(AsyncNotifier *notifier, void *data,
void *cb_data)
{
bool success_end = *(bool *)data;
+
+#ifdef SPICE_INTERFACE_MIGRATION
+ spice_migrate.end_complete.cb = complete_cb;
+ spice_migrate.end_complete.opaque = cb_data;
+ spice_server_migrate_end(spice_server, success_end);
+#else
if (success_end) {
-#ifndef SPICE_INTERFACE_MIGRATION
spice_server_migrate_switch(spice_server);
-#else
- spice_server_migrate_end(spice_server, true);
- } else {
- spice_server_migrate_end(spice_server, false);
-#endif
}
complete_cb(notifier, cb_data);
+#endif
}
int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,
--
1.7.7.6
next prev parent reply other threads:[~2012-06-05 5:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 5:49 [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers Yonit Halperin
2012-06-05 5:49 ` [Qemu-devel] [RFC PATCH 1/5] notifiers: add support for async notifiers handlers Yonit Halperin
2012-06-05 8:36 ` Gerd Hoffmann
2012-06-05 5:49 ` [Qemu-devel] [RFC PATCH 2/5] migration: moving migration start code to a separated routine Yonit Halperin
2012-06-05 8:44 ` Gerd Hoffmann
2012-06-05 5:49 ` [Qemu-devel] [RFC PATCH 3/5] migration: moving migration completion " Yonit Halperin
2012-06-05 8:46 ` Gerd Hoffmann
2012-06-05 5:49 ` [Qemu-devel] [RFC PATCH 4/5] migration: replace migration state change notifier with async notifiers Yonit Halperin
2012-06-05 5:49 ` Yonit Halperin [this message]
2012-06-05 11:59 ` [Qemu-devel] [RFC PATCH 0/5] asynchronous migration state change handlers Anthony Liguori
2012-06-05 13:15 ` Gerd Hoffmann
2012-06-05 13:38 ` Eric Blake
2012-06-05 21:37 ` Anthony Liguori
2012-06-06 9:10 ` Yonit Halperin
2012-06-06 9:22 ` Anthony Liguori
2012-06-06 10:54 ` Alon Levy
2012-06-06 11:05 ` Anthony Liguori
2012-06-06 11:27 ` Alon Levy
2012-06-06 11:49 ` Anthony Liguori
2012-06-06 12:01 ` Yonit Halperin
2012-06-06 12:08 ` Anthony Liguori
2012-06-06 12:15 ` Alon Levy
2012-06-06 12:17 ` Anthony Liguori
2012-06-06 12:30 ` Alon Levy
2012-06-06 12:34 ` Anthony Liguori
2012-06-06 13:03 ` Gerd Hoffmann
2012-06-06 14:52 ` Alon Levy
2012-06-06 15:00 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338875386-21051-6-git-send-email-yhalperi@redhat.com \
--to=yhalperi@redhat.com \
--cc=alevy@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).