From: Yang Hongyang Subject: [PATCH v8 --for 4.6 COLO 02/25] docs/libxl: Introduce COLO_CONTEXT to support migration v2 colo streams Date: Wed, 15 Jul 2015 17:18:33 +0800 Message-ID: <1436951936-3447-3-git-send-email-yanghy@cn.fujitsu.com> References: <1436951936-3447-1-git-send-email-yanghy@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436951936-3447-1-git-send-email-yanghy@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, wency@cn.fujitsu.com, andrew.cooper3@citrix.com, yunhong.jiang@intel.com, eddie.dong@intel.com, guijianfeng@cn.fujitsu.com, rshriram@cs.ubc.ca, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org 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 --- docs/specs/libxl-migration-stream.pandoc | 22 +++++++++++++++++++++- tools/libxl/libxl_sr_stream_format.h | 11 +++++++++++ tools/python/xen/migration/libxl.py | 9 +++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/specs/libxl-migration-stream.pandoc b/docs/specs/libxl-migration-stream.pandoc index c24a434..5986273 100644 --- a/docs/specs/libxl-migration-stream.pandoc +++ b/docs/specs/libxl-migration-stream.pandoc @@ -121,7 +121,9 @@ type 0x00000000: END 0x00000004: CHECKPOINT_END - 0x00000005 - 0x7FFFFFFF: Reserved for future _mandatory_ + 0x00000005: COLO_CONTEXT + + 0x00000006 - 0x7FFFFFFF: Reserved for future _mandatory_ records. 0x80000000 - 0xFFFFFFFF: Reserved for future _optional_ @@ -215,3 +217,21 @@ A checkpoint end record marks the end of a checkpoint in the image. +-------------------------------------------------+ The end record contains no fields; its body_length is 0. + +COLO\_CONTEXT +-------------- + +A COLO context record contains the control information for COLO. + + 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 + 0x00000001: Secondary VM is suspended + 0x00000002: Secondary VM is ready + 0x00000003: Secondary VM is resumed diff --git a/tools/libxl/libxl_sr_stream_format.h b/tools/libxl/libxl_sr_stream_format.h index 3f3c497..1dd2ac4 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_XENSTORE_DATA 0x00000002U #define REC_TYPE_EMULATOR_CONTEXT 0x00000003U #define REC_TYPE_CHECKPOINT_END 0x00000004U +#define REC_TYPE_COLO_CONTEXT 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_colo_context +{ + uint32_t id; +} libxl_sr_colo_context; + +#define COLO_NEW_CHECKPOINT 0x00000000U +#define COLO_SVM_SUSPENDED 0x00000001U +#define COLO_SVM_READY 0x00000002U +#define COLO_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 415502e..57031c6 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_xenstore_data = 0x00000002 REC_TYPE_emulator_context = 0x00000003 REC_TYPE_checkpoint_end = 0x00000004 +REC_TYPE_colo_context = 0x00000005 rec_type_to_str = { REC_TYPE_end : "End", @@ -44,6 +45,7 @@ rec_type_to_str = { REC_TYPE_xenstore_data : "Xenstore data", REC_TYPE_emulator_context : "Emulator context", REC_TYPE_checkpoint_end : "Checkpoint end", + REC_TYPE_colo_context : "COLO context" } # emulator_context @@ -184,6 +186,11 @@ class VerifyLibxl(VerifyBase): if len(content) != 0: raise RecordError("Checkpoint end record with non-zero length") + def verify_record_colo_context(self, content): + """ COLO context """ + if len(content) == 0: + raise RecordError("COLO context record with zero length") + record_verifiers = { REC_TYPE_end: @@ -196,4 +203,6 @@ record_verifiers = { VerifyLibxl.verify_record_emulator_context, REC_TYPE_checkpoint_end: VerifyLibxl.verify_record_checkpoint_end, + REC_TYPE_colo_context: + VerifyLibxl.verify_record_colo_context, } -- 1.9.1