From patchwork Tue Jun 5 05:49:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonit Halperin X-Patchwork-Id: 163020 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F1AA6B6F77 for ; Tue, 5 Jun 2012 16:16:38 +1000 (EST) Received: from localhost ([::1]:57058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbme0-0003QC-QA for incoming@patchwork.ozlabs.org; Tue, 05 Jun 2012 01:49:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbmdO-0001a1-9u for qemu-devel@nongnu.org; Tue, 05 Jun 2012 01:48:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbmdM-0005KZ-EG for qemu-devel@nongnu.org; Tue, 05 Jun 2012 01:48:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbmdM-0005KP-5U for qemu-devel@nongnu.org; Tue, 05 Jun 2012 01:48:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q555mkls001376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Jun 2012 01:48:46 -0400 Received: from dhcp-0-9.tlv.redhat.com (dhcp-4-73.tlv.redhat.com [10.35.4.73]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q555mZB6025474; Tue, 5 Jun 2012 01:48:45 -0400 From: Yonit Halperin To: qemu-devel@nongnu.org Date: Tue, 5 Jun 2012 08:49:46 +0300 Message-Id: <1338875386-21051-6-git-send-email-yhalperi@redhat.com> In-Reply-To: <1338875386-21051-1-git-send-email-yhalperi@redhat.com> References: <1338875386-21051-1-git-send-email-yhalperi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Yonit Halperin , 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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,