|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] libxc/restore: Support v3 streams and handle STATIC_DATA_END
commit 6501e46ca797d445253ee48974220d939ae9ec4f
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Dec 16 19:03:14 2019 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri May 29 17:33:03 2020 +0100
libxc/restore: Support v3 streams and handle STATIC_DATA_END
Higher level toolstacks may wish to know when the static data is complete,
so
introduce a restore_callback for the purpose.
No functional change.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/libxc/include/xenguest.h | 3 +++
tools/libxc/xc_sr_common.h | 3 +++
tools/libxc/xc_sr_restore.c | 29 +++++++++++++++++++++++++++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h
index 19d828a7f2..efd90b0d42 100644
--- a/tools/libxc/include/xenguest.h
+++ b/tools/libxc/include/xenguest.h
@@ -139,6 +139,9 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t
dom,
/* 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);
diff --git a/tools/libxc/xc_sr_common.h b/tools/libxc/xc_sr_common.h
index 5dd51ccb15..ae0ab70f76 100644
--- a/tools/libxc/xc_sr_common.h
+++ b/tools/libxc/xc_sr_common.h
@@ -253,6 +253,9 @@ struct xc_sr_context
/* 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
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index dc2ffcf855..9c924387ae 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -35,9 +35,9 @@ static int read_headers(struct xc_sr_context *ctx)
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;
}
@@ -631,6 +631,27 @@ static int buffer_record(struct xc_sr_context *ctx, struct
xc_sr_record *rec)
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;
@@ -654,6 +675,10 @@ static int process_record(struct xc_sr_context *ctx,
struct xc_sr_record *rec)
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;
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |