int (*setup)(struct xc_sr_context *ctx);
/**
- * Send records which need to be at the start of the stream. This is
- * called once, after the Image and Domain headers are written.
+ * Send static records at the head of the stream. This is called once,
+ * after the Image and Domain headers are written.
+ */
+ int (*static_data)(struct xc_sr_context *ctx);
+
+ /**
+ * Send dynamic records which need to be at the start of the stream. This
+ * is called after the STATIC_DATA_END record is written.
*/
int (*start_of_stream)(struct xc_sr_context *ctx);
struct xc_sr_ihdr ihdr = {
.marker = IHDR_MARKER,
.id = htonl(IHDR_ID),
- .version = htonl(2),
+ .version = htonl(3),
.options = htons(IHDR_OPT_LITTLE_ENDIAN),
};
struct xc_sr_dhdr dhdr = {
return write_record(ctx, &end);
}
+/*
+ * Writes a STATIC_DATA_END record into the stream.
+ */
+static int write_static_data_end_record(struct xc_sr_context *ctx)
+{
+ struct xc_sr_record end = { .type = REC_TYPE_STATIC_DATA_END };
+
+ return write_record(ctx, &end);
+}
+
/*
* Writes a CHECKPOINT record into the stream.
*/
if ( rc )
goto err;
+ rc = ctx->save.ops.static_data(ctx);
+ if ( rc )
+ goto err;
+
+ rc = write_static_data_end_record(ctx);
+ if ( rc )
+ goto err;
+
rc = ctx->save.ops.start_of_stream(ctx);
if ( rc )
goto err;
return 0;
}
+static int x86_hvm_static_data(struct xc_sr_context *ctx)
+{
+ return 0;
+}
+
static int x86_hvm_start_of_stream(struct xc_sr_context *ctx)
{
return 0;
.pfn_to_gfn = x86_hvm_pfn_to_gfn,
.normalise_page = x86_hvm_normalise_page,
.setup = x86_hvm_setup,
+ .static_data = x86_hvm_static_data,
.start_of_stream = x86_hvm_start_of_stream,
.start_of_checkpoint = x86_hvm_start_of_checkpoint,
.end_of_checkpoint = x86_hvm_end_of_checkpoint,
return 0;
}
+static int x86_pv_static_data(struct xc_sr_context *ctx)
+{
+ return write_x86_pv_info(ctx);
+}
+
static int x86_pv_start_of_stream(struct xc_sr_context *ctx)
{
int rc;
- rc = write_x86_pv_info(ctx);
- if ( rc )
- return rc;
-
/*
* Ideally should be able to change during migration. Currently
* corruption will occur if the contents or location of the P2M changes
.pfn_to_gfn = x86_pv_pfn_to_gfn,
.normalise_page = x86_pv_normalise_page,
.setup = x86_pv_setup,
+ .static_data = x86_pv_static_data,
.start_of_stream = x86_pv_start_of_stream,
.start_of_checkpoint = x86_pv_start_of_checkpoint,
.end_of_checkpoint = x86_pv_end_of_checkpoint,
stream_write(pack(libxc.IHDR_FORMAT,
libxc.IHDR_MARKER, # Marker
libxc.IHDR_IDENT, # Ident
- 2, # Version
+ 3, # Version
libxc.IHDR_OPT_LE, # Options
0, 0)) # Reserved
pack(libxc.HVM_PARAMS_FORMAT, len(params) / 2, 0),
pack("Q" * len(params), *params))
+def write_libxc_static_data_end():
+ write_record(libxc.REC_TYPE_static_data_end)
+
def write_libxl_end():
write_record(libxl.REC_TYPE_end)
if pv:
read_pv_extended_info(vm)
+
+ write_libxc_static_data_end()
+
+ if pv:
read_pv_p2m_frames(vm)
read_chunks(vm)