From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Subject: Re: [PATCH 22/27] docs/libxl: [RFC] Introduce CHECKPOINT_END to support migration v2 remus streams Date: Wed, 17 Jun 2015 11:30:48 +0800 Message-ID: <5580E9E8.80100@cn.fujitsu.com> References: <1434375880-30914-1-git-send-email-andrew.cooper3@citrix.com> <1434375880-30914-23-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1434375880-30914-23-git-send-email-andrew.cooper3@citrix.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: Andrew Cooper , Xen-devel Cc: Ian Jackson , Yang Hongyang , Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org On 06/15/2015 09:44 PM, Andrew Cooper wrote: > In a remus senario, libxc will write a CHECKPOINT record, then hand ownership > of the fd to libxl. Libxl then writes any records required and finishes with > a CHECKPOINT_END record, then hands ownership of the fd back to libxc. > > Signed-off-by: Andrew Cooper > CC: Ian Campbell > CC: Ian Jackson > CC: Wei Liu > --- > docs/specs/libxl-migration-stream.pandoc | 15 ++++++++++++++- > tools/libxl/libxl_sr_stream_format.h | 1 + > tools/python/xen/migration/libxl.py | 11 +++++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) > > diff --git a/docs/specs/libxl-migration-stream.pandoc b/docs/specs/libxl-migration-stream.pandoc > index 7235317..d41932a 100644 > --- a/docs/specs/libxl-migration-stream.pandoc > +++ b/docs/specs/libxl-migration-stream.pandoc > @@ -119,7 +119,9 @@ type 0x00000000: END > > 0x00000003: EMULATOR_CONTEXT > > - 0x00000004 - 0x7FFFFFFF: Reserved for future _mandatory_ > + 0x00000004: CHECKPOINT_END > + > + 0x00000005 - 0x7FFFFFFF: Reserved for future _mandatory_ > records. > > 0x80000000 - 0xFFFFFFFF: Reserved for future _optional_ > @@ -203,3 +205,14 @@ index Index of this emulator for the domain, if multiple > > emulator_ctx Emulator context blob. > -------------------------------------------------------------------- > + > +CHECKPOINT_END CHECKPOINT\_END? > +-------------- > + > +A checkpoint end record marks the end of a checkpoint in the image. > + > + 0 1 2 3 4 5 6 7 octet > + +-------------------------------------------------+ > + > +The end record contains no fields; its body_length is 0. > + > diff --git a/tools/libxl/libxl_sr_stream_format.h b/tools/libxl/libxl_sr_stream_format.h > index 487f9e2..5dfa55f 100644 > --- a/tools/libxl/libxl_sr_stream_format.h > +++ b/tools/libxl/libxl_sr_stream_format.h > @@ -35,6 +35,7 @@ > #define REC_TYPE_LIBXC_CONTEXT 0x00000001U > #define REC_TYPE_XENSTORE_DATA 0x00000002U > #define REC_TYPE_EMULATOR_CONTEXT 0x00000003U > +#define REC_TYPE_CHECKPOINT_END 0x00000004U > > typedef struct libxl_sr_emulator_hdr > { > diff --git a/tools/python/xen/migration/libxl.py b/tools/python/xen/migration/libxl.py > index 4e1f4f8..415502e 100644 > --- a/tools/python/xen/migration/libxl.py > +++ b/tools/python/xen/migration/libxl.py > @@ -36,12 +36,14 @@ REC_TYPE_end = 0x00000000 > REC_TYPE_libxc_context = 0x00000001 > REC_TYPE_xenstore_data = 0x00000002 > REC_TYPE_emulator_context = 0x00000003 > +REC_TYPE_checkpoint_end = 0x00000004 > > rec_type_to_str = { > REC_TYPE_end : "End", > REC_TYPE_libxc_context : "Libxc context", > REC_TYPE_xenstore_data : "Xenstore data", > REC_TYPE_emulator_context : "Emulator context", > + REC_TYPE_checkpoint_end : "Checkpoint end", > } > > # emulator_context > @@ -176,6 +178,13 @@ class VerifyLibxl(VerifyBase): > self.info(" Index %d, type %s" % (emu_idx, emulator_id_to_str[emu_id])) > > > + def verify_record_checkpoint_end(self, content): > + """ Checkpoint end record """ > + > + if len(content) != 0: > + raise RecordError("Checkpoint end record with non-zero length") > + > + > record_verifiers = { > REC_TYPE_end: > VerifyLibxl.verify_record_end, > @@ -185,4 +194,6 @@ record_verifiers = { > VerifyLibxl.verify_record_xenstore_data, > REC_TYPE_emulator_context: > VerifyLibxl.verify_record_emulator_context, > + REC_TYPE_checkpoint_end: > + VerifyLibxl.verify_record_checkpoint_end, > } >