/* callbacks provided by xc_domain_restore */
struct restore_callbacks {
+ /* Called once the STATIC_DATA_END record has been received. */
+ int (*static_data_done)(void *data);
+
/* Called after a new checkpoint to suspend the guest. */
int (*suspend)(void *data);
/* Currently buffering records between a checkpoint */
bool buffer_all_records;
+ /* Whether a STATIC_DATA_END record has been seen. */
+ bool seen_static_data_end;
+
/*
* With Remus/COLO, we buffer the records sent by the primary at checkpoint,
* in case the primary will fail, we can recover from the last
return -1;
}
- if ( ihdr.version != 2 )
+ if ( ihdr.version < 2 || ihdr.version > 3 )
{
- ERROR("Invalid Version: Expected 2, Got %d",
+ ERROR("Invalid Version: Expected 2 <= ver <= 3, Got %d",
ihdr.version);
return -1;
}
return 0;
}
+static int handle_static_data_end(struct xc_sr_context *ctx)
+{
+ xc_interface *xch = ctx->xch;
+ int rc = 0;
+
+ if ( ctx->restore.seen_static_data_end )
+ {
+ ERROR("Multiple STATIC_DATA_END records found");
+ return -1;
+ }
+
+ ctx->restore.seen_static_data_end = true;
+
+ if ( ctx->restore.callbacks->static_data_done &&
+ (rc = ctx->restore.callbacks->static_data_done(
+ ctx->restore.callbacks->data) != 0) )
+ ERROR("static_data_done() callback failed: %d\n", rc);
+
+ return rc;
+}
+
static int process_record(struct xc_sr_context *ctx, struct xc_sr_record *rec)
{
xc_interface *xch = ctx->xch;
rc = handle_checkpoint(ctx);
break;
+ case REC_TYPE_STATIC_DATA_END:
+ rc = handle_static_data_end(ctx);
+ break;
+
default:
rc = ctx->restore.ops.process_record(ctx, rec);
break;