From patchwork Wed Sep 21 15:51:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonit Halperin X-Patchwork-Id: 115829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2211EB6F75 for ; Thu, 22 Sep 2011 03:10:04 +1000 (EST) Received: from localhost ([::1]:58079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6QJ1-0001kM-MQ for incoming@patchwork.ozlabs.org; Wed, 21 Sep 2011 13:09:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6P57-0000PL-U8 for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6P56-000074-NX for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6P56-00006n-9o for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:28 -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 p8LFpQFp032659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Sep 2011 11:51:27 -0400 Received: from dhcp-0-9.tlv.redhat.com (dhcp-3-166.tlv.redhat.com [10.35.3.166]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8LFpKu9029127; Wed, 21 Sep 2011 11:51:25 -0400 From: Yonit Halperin To: spice-devel@freedesktop.org Date: Wed, 21 Sep 2011 18:51:12 +0300 Message-Id: <1316620283-8330-3-git-send-email-yhalperi@redhat.com> In-Reply-To: <1316620283-8330-1-git-send-email-yhalperi@redhat.com> References: <1316620283-8330-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: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Yonit Halperin , alevy@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com Subject: [Qemu-devel] [PATCH spice-server 02/13] server: handle migration interface addition 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 Signed-off-by: Yonit Halperin --- server/reds.c | 29 +++++++++++++++++++++++++++++ server/reds.h | 4 ++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/server/reds.c b/server/reds.c index 9a983f8..99d52f9 100644 --- a/server/reds.c +++ b/server/reds.c @@ -73,6 +73,7 @@ static SpiceKbdInstance *keyboard = NULL; static SpiceMouseInstance *mouse = NULL; static SpiceTabletInstance *tablet = NULL; static SpiceCharDeviceInstance *vdagent = NULL; +static SpiceMigrateInstance *migration_interface = NULL; #define MIGRATION_NOTIFY_SPICE_KEY "spice_mig_ext" @@ -4345,6 +4346,20 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s, red_printf("unsupported net wire interface"); return -1; #endif + } else if (strcmp(interface->type, SPICE_INTERFACE_MIGRATION) == 0) { + red_printf("SPICE_INTERFACE_MIGRATION"); + if (migration_interface) { + red_printf("already have migration"); + return -1; + } + + if (interface->major_version != SPICE_INTERFACE_MIGRATION_MAJOR || + interface->minor_version > SPICE_INTERFACE_MIGRATION_MINOR) { + red_printf("unsupported migration interface"); + return -1; + } + migration_interface = SPICE_CONTAINEROF(sin, SpiceMigrateInstance, base); + migration_interface->st = spice_new0(SpiceMigrateState, 1); } return 0; @@ -4859,7 +4874,15 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *s, const char* int port, int secure_port, const char* cert_subject) { + SpiceMigrateInterface *sif; + red_printf(""); + ASSERT(migration_interface); + ASSERT(reds == s); + red_printf("not implemented yet"); + sif = SPICE_CONTAINEROF(migration_interface->base.sif, SpiceMigrateInterface, base); + sif->migrate_connect_complete(migration_interface); + return 0; } @@ -4920,8 +4943,14 @@ SPICE_GNUC_VISIBLE int spice_server_migrate_client_state(SpiceServer *s) SPICE_GNUC_VISIBLE int spice_server_migrate_end(SpiceServer *s, int completed) { + SpiceMigrateInterface *sif; + ASSERT(migration_interface); ASSERT(reds == s); reds_mig_finished(completed); + sif = SPICE_CONTAINEROF(migration_interface->base.sif, SpiceMigrateInterface, base); + if (sif->migrate_end_complete) { + sif->migrate_end_complete(migration_interface); + } return 0; } diff --git a/server/reds.h b/server/reds.h index 463c94f..b60681a 100644 --- a/server/reds.h +++ b/server/reds.h @@ -119,6 +119,10 @@ struct SpiceNetWireState { struct TunnelWorker *worker; }; +struct SpiceMigrateState { + int dummy; +}; + void reds_channel_dispose(Channel *channel); ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte);