This is a complicated set of changes which must be done together for
bisectability.
* libxl-save-helper is updated to unconditionally use libxc migration v2.
* libxl compatibility workarounds in libxc are disabled for save operations.
* libxl__stream_write_start() is logically spliced into the event location
where libxl__xc_domain_save() used to reside.
* Ownership of the helper state moves into stream_write_state.
* xl is updated to indicate that the stream is now v2
Signed-off-by: Andrew Cooper
CC: Ian Campbell
CC: Ian Jackson
CC: Wei Liu
---
v3: Many small changes, follwing similar review to the restore side
---
tools/libxc/Makefile |2 --
tools/libxl/libxl.h |2 ++
tools/libxl/libxl_dom.c | 73 --
tools/libxl/libxl_internal.h |3 +-
tools/libxl/libxl_save_helper.c |2 +-
tools/libxl/libxl_stream_write.c | 39 +---
tools/libxl/xl_cmdimpl.c |1 +
7 files changed, 63 insertions(+), 59 deletions(-)
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index 2cd0b1a..1aec848 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -64,8 +64,6 @@ GUEST_SRCS-$(CONFIG_X86) += xc_sr_save_x86_hvm.c
GUEST_SRCS-y += xc_sr_restore.c
GUEST_SRCS-y += xc_sr_save.c
GUEST_SRCS-y += xc_offline_page.c xc_compression.c
-xc_sr_save_x86_hvm.o: CFLAGS += -DXG_LIBXL_HVM_COMPAT
-xc_sr_save_x86_hvm.opic: CFLAGS += -DXG_LIBXL_HVM_COMPAT
else
GUEST_SRCS-y += xc_nomigrate.c
endif
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 74b0829..5a7308d 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -812,6 +812,8 @@
*
* If this is defined, then the libxl_domain_create_restore() interface takes
* a "stream_version" parameter and supports a value of 2.
+ *
+ * libxl_domain_suspend() will produce a v2 stream.
*/
#define LIBXL_HAVE_SRM_V2 1
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 9719837..0794b30 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1153,6 +1153,8 @@ int libxl__toolstack_restore(uint32_t domid, const
uint8_t *ptr,
/* Domain suspend (save) */
+static void stream_done(libxl__egc *egc,
+libxl__stream_write_state *sws, int rc);
static void domain_suspend_done(libxl__egc *egc,
libxl__domain_suspend_state *dss, int rc);
static void domain_suspend_callback_common_done(libxl__egc *egc,
@@ -1379,7 +1381,7 @@ static void switch_logdirty_done(libxl__egc *egc,
} else {
broke = 0;
}
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, broke);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs,
broke);
}
/*- callbacks, called by xc_domain_save -*/
@@ -1842,7 +1844,7 @@ static void
domain_suspend_callback_common_done(libxl__egc *egc,
libxl__domain_suspend_state *dss, int rc)
{
dss->rc = rc;
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, !rc);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, !rc);
}
/*- remus callbacks -*/
@@ -1878,7 +1880,7 @@ static void
remus_domain_suspend_callback_common_done(libxl__egc *egc,
out:
dss->rc = rc;
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, !rc);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, !rc);
}
static void remus_devices_postsuspend_cb(libxl__egc *egc,
@@ -1895,7 +1897,7 @@ static void remus_devices_postsuspend_cb(libxl__egc *egc,
out:
if (rc)
dss->rc = rc;
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, !rc);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, !rc);
}
static void libxl__remus_domain_resume_callback(void *data)
@@ -1930,7 +1932,7 @@ static void remus_devices_preresume_cb(libxl__egc *egc,
out:
if (rc)
dss->rc = rc;
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, !rc);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, !rc);
}
/*- remus asynchronous checkpoint callback -*/
@@ -1978,7 +1980,7 @@ static void remus_checkpoint_dm_saved(libxl__egc *egc,
return;
out:
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, 0);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, 0);
}
static void remus_devices_commit_cb(libxl__egc *egc,
@@ -2013,7 +2015,7 @@ static void remus_devices_commit_cb(libxl__egc *egc,
return;
out:
-libxl__xc_domain_saverestore_async_callback_done(egc, &dss->shs, 0);
+libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.shs, 0);
}
static void remus_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev,
@@ -2034,7 +2036,7 @@ static void remus_next_checkpoint(libxl__egc *egc,
libxl__ev_time *ev,
i