From patchwork Fri Mar 4 08:41:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changlong Xie X-Patchwork-Id: 8500201 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2E4A89F659 for ; Fri, 4 Mar 2016 08:42:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B862201F4 for ; Fri, 4 Mar 2016 08:42:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 289632014A for ; Fri, 4 Mar 2016 08:42:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ablHE-0006Qh-8V; Fri, 04 Mar 2016 08:40:00 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ablHD-0006Or-FK for xen-devel@lists.xen.org; Fri, 04 Mar 2016 08:39:59 +0000 Received: from [193.109.254.147] by server-1.bemta-14.messagelabs.com id 48/CE-02901-ED949D65; Fri, 04 Mar 2016 08:39:58 +0000 X-Env-Sender: xiecl.fnst@cn.fujitsu.com X-Msg-Ref: server-9.tower-27.messagelabs.com!1457080794!28608841!2 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7699 invoked from network); 4 Mar 2016 08:39:57 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-9.tower-27.messagelabs.com with SMTP; 4 Mar 2016 08:39:57 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4230644" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Mar 2016 16:39:51 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 4926D42B4AFF; Fri, 4 Mar 2016 16:39:48 +0800 (CST) Received: from changlox.g08.fujitsu.local (10.167.225.55) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 4 Mar 2016 16:39:47 +0800 From: Changlong Xie To: xen devel , Konrad Rzeszutek Wilk , Andrew Cooper , Ian Campbell , Ian Jackson , Wei Liu Date: Fri, 4 Mar 2016 16:41:11 +0800 Message-ID: <1457080891-26054-8-git-send-email-xiecl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> References: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.225.55] X-yoursite-MailScanner-ID: 4926D42B4AFF.A3119 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xiecl.fnst@cn.fujitsu.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Cc: Lars Kurth , Changlong Xie , Wen Congyang , Gui Jianfeng , Jiang Yunhong , Dong Eddie , Anthony Perard , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v11 07/27] docs/libxl: Introduce CHECKPOINT_CONTEXT to support migration v2 colo streams X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wen Congyang It is the negotiation record for COLO. Primary->Secondary: control_id 0x00000000: Secondary VM is out of sync, start a new checkpoint Secondary->Primary: 0x00000001: Secondary VM is suspended 0x00000002: Secondary VM is ready 0x00000003: Secondary VM is resumed Signed-off-by: Wen Congyang Signed-off-by: Yang Hongyang Signed-off-by: Changlong Xie --- docs/specs/libxl-migration-stream.pandoc | 31 +++++++++++++++++++++++++++++-- tools/libxl/libxl_sr_stream_format.h | 11 +++++++++++ tools/python/xen/migration/libxl.py | 9 +++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/docs/specs/libxl-migration-stream.pandoc b/docs/specs/libxl-migration-stream.pandoc index 2c97d86..5d577ac 100644 --- a/docs/specs/libxl-migration-stream.pandoc +++ b/docs/specs/libxl-migration-stream.pandoc @@ -1,6 +1,8 @@ % LibXenLight Domain Image Format % Andrew Cooper <> -% Revision 1 + Wen Congyang <> + Yang Hongyang <> +% Revision 2 Introduction ============ @@ -119,7 +121,9 @@ type 0x00000000: END 0x00000004: CHECKPOINT_END - 0x00000005 - 0x7FFFFFFF: Reserved for future _mandatory_ + 0x00000005: CHECKPOINT_STATE + + 0x00000006 - 0x7FFFFFFF: Reserved for future _mandatory_ records. 0x80000000 - 0xFFFFFFFF: Reserved for future _optional_ @@ -249,6 +253,29 @@ A checkpoint end record marks the end of a checkpoint in the image. The end record contains no fields; its body_length is 0. +CHECKPOINT\_STATE +-------------- + +A checkpoint state record contains the control information for checkpoint. + + 0 1 2 3 4 5 6 7 octet + +------------------------+------------------------+ + | control_id | padding | + +------------------------+------------------------+ + +-------------------------------------------------------------------- +Field Description +------------ --------------------------------------------------- +control_id 0x00000000: Secondary VM is out of sync, start a new checkpoint + (Primary -> Secondary) + + 0x00000001: Secondary VM is suspended (Secondary -> Primary) + + 0x00000002: Secondary VM is ready (Secondary -> Primary) + + 0x00000003: Secondary VM is resumed (Secondary -> Primary) +-------------------------------------------------------------------- + Future Extensions ================= diff --git a/tools/libxl/libxl_sr_stream_format.h b/tools/libxl/libxl_sr_stream_format.h index 54da360..75f5190 100644 --- a/tools/libxl/libxl_sr_stream_format.h +++ b/tools/libxl/libxl_sr_stream_format.h @@ -36,6 +36,7 @@ typedef struct libxl__sr_rec_hdr #define REC_TYPE_EMULATOR_XENSTORE_DATA 0x00000002U #define REC_TYPE_EMULATOR_CONTEXT 0x00000003U #define REC_TYPE_CHECKPOINT_END 0x00000004U +#define REC_TYPE_CHECKPOINT_STATE 0x00000005U typedef struct libxl__sr_emulator_hdr { @@ -47,6 +48,16 @@ typedef struct libxl__sr_emulator_hdr #define EMULATOR_QEMU_TRADITIONAL 0x00000001U #define EMULATOR_QEMU_UPSTREAM 0x00000002U +typedef struct libxl_sr_checkpoint_state +{ + uint32_t id; +} libxl_sr_checkpoint_state; + +#define CHECKPOINT_NEW 0x00000000U +#define CHECKPOINT_SVM_SUSPENDED 0x00000001U +#define CHECKPOINT_SVM_READY 0x00000002U +#define CHECKPOINT_SVM_RESUMED 0x00000003U + #endif /* LIBXL__SR_STREAM_FORMAT_H */ /* diff --git a/tools/python/xen/migration/libxl.py b/tools/python/xen/migration/libxl.py index fc0acf6..d5f54dc 100644 --- a/tools/python/xen/migration/libxl.py +++ b/tools/python/xen/migration/libxl.py @@ -37,6 +37,7 @@ REC_TYPE_libxc_context = 0x00000001 REC_TYPE_emulator_xenstore_data = 0x00000002 REC_TYPE_emulator_context = 0x00000003 REC_TYPE_checkpoint_end = 0x00000004 +REC_TYPE_checkpoint_state = 0x00000005 rec_type_to_str = { REC_TYPE_end : "End", @@ -44,6 +45,7 @@ rec_type_to_str = { REC_TYPE_emulator_xenstore_data : "Emulator xenstore data", REC_TYPE_emulator_context : "Emulator context", REC_TYPE_checkpoint_end : "Checkpoint end", + REC_TYPE_checkpoint_state : "Checkpoint state" } # emulator_* header @@ -212,6 +214,11 @@ class VerifyLibxl(VerifyBase): if len(content) != 0: raise RecordError("Checkpoint end record with non-zero length") + def verify_record_checkpoint_state(self, content): + """ Checkpoint state """ + if len(content) == 0: + raise RecordError("Checkpoint state record with zero length") + record_verifiers = { REC_TYPE_end: @@ -224,4 +231,6 @@ record_verifiers = { VerifyLibxl.verify_record_emulator_context, REC_TYPE_checkpoint_end: VerifyLibxl.verify_record_checkpoint_end, + REC_TYPE_checkpoint_state: + VerifyLibxl.verify_record_checkpoint_state, }