From patchwork Wed Sep 21 15:51:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonit Halperin X-Patchwork-Id: 115817 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 559AEB6F92 for ; Thu, 22 Sep 2011 02:37:21 +1000 (EST) Received: from localhost ([::1]:52854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6PnK-00062y-Jk for incoming@patchwork.ozlabs.org; Wed, 21 Sep 2011 12:37:10 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6P58-0000Pi-9y for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6P54-00005z-3a for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6P53-00005h-SJ for qemu-devel@nongnu.org; Wed, 21 Sep 2011 11:51:26 -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 p8LFpOCF024469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Sep 2011 11:51:24 -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 p8LFpKu8029127; Wed, 21 Sep 2011 11:51:22 -0400 From: Yonit Halperin To: spice-devel@freedesktop.org Date: Wed, 21 Sep 2011 18:51:11 +0300 Message-Id: <1316620283-8330-2-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 01/13] server/spice.h: semi-seamless migration interface, RHBZ #738266 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 semi-seamless migration details: migration source side --------------------- (1) spice_server_migrate_connect (*): tell client to link to the target side - send SPICE_MSG_MAIN_MIGRATE_BEGIN. This should be called upon client_migrate_info cmd. client_migrate_info is asynchronous. (2) Complete spice_server_migrate_connect only when the client has been connected to the target - wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) or a timeout. (3) spice_server_migrate_end: tell client migration it can switch to the target - send SPICE_MSG_MAIN_MIGRATE_END. (4) client cleans up all data related to the connection to the source and switches to the target. It sends SPICE_MSGC_MAIN_MIGRATE_END. migration target side --------------------- (1) the server identifies itself as a migraiton target since the client is linked with (connection_id != 0) (2) server doesn't start the channels' logic (channel->link) till it receives SPICE_MSGC_MAIN_MIGRATE_END from the client. * After migration starts, the target qemu is blocked and cannot accept new spice client connections. Thus, we trigger the connection to the target upon client_migrate_info command. Signed-off-by: Yonit Halperin --- server/reds.c | 9 +++++++++ server/spice-experimental.h | 3 --- server/spice.h | 27 ++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/server/reds.c b/server/reds.c index f082c53..9a983f8 100644 --- a/server/reds.c +++ b/server/reds.c @@ -4854,6 +4854,15 @@ SPICE_GNUC_VISIBLE int spice_server_set_agent_copypaste(SpiceServer *s, int enab return 0; } +/* semi-seamless client migration */ +SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *s, const char* dest, + int port, int secure_port, + const char* cert_subject) +{ + red_printf("not implemented yet"); + return 0; +} + SPICE_GNUC_VISIBLE int spice_server_migrate_info(SpiceServer *s, const char* dest, int port, int secure_port, const char* cert_subject) diff --git a/server/spice-experimental.h b/server/spice-experimental.h index 482ac44..6997aa0 100644 --- a/server/spice-experimental.h +++ b/server/spice-experimental.h @@ -29,16 +29,13 @@ void spice_server_net_wire_recv_packet(SpiceNetWireInstance *sin, const uint8_t *pkt, int len); /* spice seamless client migration (broken) */ - enum { SPICE_MIGRATE_CLIENT_NONE = 1, SPICE_MIGRATE_CLIENT_WAITING, SPICE_MIGRATE_CLIENT_READY, }; -int spice_server_migrate_start(SpiceServer *s); int spice_server_migrate_client_state(SpiceServer *s); -int spice_server_migrate_end(SpiceServer *s, int completed); #endif // __SPICE_EXPERIMENTAL_H__ diff --git a/server/spice.h b/server/spice.h index ac5a41e..42ddbc6 100644 --- a/server/spice.h +++ b/server/spice.h @@ -469,11 +469,36 @@ int spice_server_set_agent_copypaste(SpiceServer *s, int enable); int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen); int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa, socklen_t *salen); -/* spice switch-host client migration */ +/* migration interface */ +#define SPICE_INTERFACE_MIGRATION "migration" +#define SPICE_INTERFACE_MIGRATION_MAJOR 1 +#define SPICE_INTERFACE_MIGRATION_MINOR 1 +typedef struct SpiceMigrateInterface SpiceMigrateInterface; +typedef struct SpiceMigrateInstance SpiceMigrateInstance; +typedef struct SpiceMigrateState SpiceMigrateState; + +struct SpiceMigrateInterface { + SpiceBaseInterface base; + void (*migrate_connect_complete)(SpiceMigrateInstance *sin); + void (*migrate_end_complete)(SpiceMigrateInstance *sin); +}; + +struct SpiceMigrateInstance { + SpiceBaseInstance base; + SpiceMigrateState *st; +}; +/* spice switch-host client migration */ int spice_server_migrate_info(SpiceServer *s, const char* dest, int port, int secure_port, const char* cert_subject); int spice_server_migrate_switch(SpiceServer *s); +/* spice (semi-)seamless client migration */ +int spice_server_migrate_connect(SpiceServer *s, const char* dest, + int port, int secure_port, + const char* cert_subject); +int spice_server_migrate_start(SpiceServer *s); +int spice_server_migrate_end(SpiceServer *s, int completed); + #endif