Prerequisite patches for COLO
v5 cover Prerequisite patches for COLO
This patchset is Prerequisite for COLO feature. Refer to:
http://wiki.xen.org/wiki/COLO_-_Coarse_Grain_Lock_Stepping
v4->v5:
- Rebased to the latest xen
- Addressed comments from last round
v3->v4:
- Rebased to the latest migration v2 branch
- Addressed comments from last round
v2->v3:
- Merge '[PATCH v2 0/6] Misc cleanups for libxl' into this patchset for easy review
- Addressed review comments
- Add back channel to libxc
- Introduce should_checkpoint callback
- Introduce DIRTY_BITMAP record on libxc side
- Introduce COLO_CONTEXT record on libxl side
- Ported to Libxl migration v2
v1->v2:
- Rebased to [PATCH v2 0/6] Misc cleanups for libxl
- Add a bugfix for the error handling of process_record
Wen Congyang (2):
tools/libxc: support to resume uncooperative HVM guests tools/libx{l,c}: add back channel to libxc
Yang Hongyang (16):
libxl/remus: init checkpoint_callback in Remus setup callback tools/libxl: move remus code into libxl_remus.c tools/libxl: move save/restore code into libxl_dom_save.c libxl/save: Refactor libxl__domain_suspend_state tools/libxl: introduce enum type libxl_checkpointed_stream migration/save: pass checkpointed_stream from libxl to libxc tools/libxl: introduce libxl__domain_restore_device_model to load qemu
state
tools/libxl: introduce libxl__domain_common_switch_qemu_logdirty() tools/libxl: export logdirty_init
tools/libxl: Add back channel to allow migration target send data back tools/libxl: rename remus device to checkpoint device tools/libxl: fix backword compatibility after the automatic renaming tools/libxl: adjust the indentation
tools/libxl: store remus_ops in checkpoint device state tools/libxl: move remus state into a seperate structure tools/libxl: seperate device init/cleanup from checkpoint device layer
tools/libxc/include/xenguest.h | 8 +- tools/libxc/xc_nomigrate.c | 5 +- tools/libxc/xc_resume.c | 24 +- tools/libxc/xc_sr_common.h | 12 +- tools/libxc/xc_sr_restore.c | 2 +- tools/libxc/xc_sr_save.c | 16 +- tools/libxl/Makefile | 4 +- tools/libxl/libxl.c | 83 +--- tools/libxl/libxl.h | 50 +- tools/libxl/libxl_checkpoint_device.c | 282 ++++++++++++ tools/libxl/libxl_create.c | 42 +- tools/libxl/libxl_dom.c | 831 ---------------------------------- tools/libxl/libxl_dom_save.c | 646 ++++++++++++++++++++++++++ tools/libxl/libxl_dom_suspend.c | 217 +++++---- tools/libxl/libxl_internal.h | 238 ++++++---- tools/libxl/libxl_netbuffer.c | 117 ++--- tools/libxl/libxl_nonetbuffer.c | 10 +- tools/libxl/libxl_qmp.c | 10 + tools/libxl/libxl_remus.c | 410 +++++++++++++++++ tools/libxl/libxl_remus_device.c | 327 ------------- tools/libxl/libxl_remus_disk_drbd.c | 56 +-- tools/libxl/libxl_save_callout.c | 43 +- tools/libxl/libxl_save_helper.c | 9 +- tools/libxl/libxl_stream_write.c | 16 +- tools/libxl/libxl_types.idl | 11 +- tools/libxl/xl_cmdimpl.c | 26 +- tools/ocaml/libs/xl/xenlight_stubs.c | 2 +- 27 files changed, 1922 insertions(+), 1575 deletions(-) create mode 100644 tools/libxl/libxl_checkpoint_device.c create mode 100644 tools/libxl/libxl_dom_save.c create mode 100644 tools/libxl/libxl_remus.c delete mode 100644 tools/libxl/libxl_remus_device.c
Signature · 1 line
2.5.0
PATCH v5 1/18 libxl/remus: init checkpoint_callback in Remus setup callback
From: Yang Hongyang <[email protected]>
init stream {read/write} state checkpoint_callback in Remus setup callback. There's no functional change, it's just refactoring so that we can move all remus code into one file.
--- tools/libxl/libxl.c | 2 ++ tools/libxl/libxl_create.c | 8 +++++++- tools/libxl/libxl_dom.c | 5 +---- tools/libxl/libxl_internal.h | 4 ++++ 4 files changed, 14 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +2 -0
@@ -918,6 +918,8 @@ static void libxl__remus_setup(libxl__egc *egc, rds->domid = dss->domid; rds->callback = remus_setup_done; + dss->sws.checkpoint_callback = remus_checkpoint_stream_written; +libxl__remus_devices_setup (egc, rds);return ;
tools/libxl/libxl_create.c +7 -1
@@ -709,6 +709,12 @@ static void remus_checkpoint_stream_done(libxl__xc_domain_saverestore_async_callback_done (egc, &stream->shs, rc); } +static void libxl__remus_restore_setup (libxl__egc *egc, +libxl__domain_create_state *dcs) +{ + dcs->srs.checkpoint_callback = remus_checkpoint_stream_done; +} +/*----- main domain creation -----*/ /* We have a linear control flow; only one event callback is
@@ -1033,9 +1039,9 @@ static void domcreate_bootloader_done(libxl__egc *egc, dcs->srs.fd = restore_fd; dcs->srs.legacy = (dcs->restore_params.stream_version ==1 ); dcs->srs.completion_callback = domcreate_stream_done; - dcs->srs.checkpoint_callback = remus_checkpoint_stream_done;if (restore_fd >=0 ) { +libxl__remus_restore_setup (egc, dcs);libxl__stream_read_start (egc, &dcs->srs);return ; }
tools/libxl/libxl_dom.c +1 -4
@@ -1569,8 +1569,6 @@ out:/*----- remus asynchronous checkpoint callback -----*/ -static void remus_checkpoint_stream_written ( -libxl__egc *egc,libxl__stream_write_state *sws,int rc);static void remus_devices_commit_cb (libxl__egc *egc,libxl__remus_devices_state *rds,int rc);
@@ -1588,7 +1586,7 @@ static void libxl__remus_domain_save_checkpoint_callback(void *data)libxl__stream_write_start_checkpoint (egc, &dss->sws); } -static void remus_checkpoint_stream_written ( +void remus_checkpoint_stream_written (libxl__egc *egc,libxl__stream_write_state *sws,int rc) {libxl__domain_suspend_state *dss =CONTAINER_OF (sws, *dss, sws);
@@ -1761,7 +1759,6 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_suspend_state *dss) callbacks->suspend = libxl__remus_domain_suspend_callback; callbacks->postcopy = libxl__remus_domain_resume_callback; callbacks->checkpoint = libxl__remus_domain_save_checkpoint_callback; - dss->sws.checkpoint_callback = remus_checkpoint_stream_written; }else callbacks->suspend = libxl__domain_suspend_callback;
tools/libxl/libxl_internal.h +4 -0
@@ -3510,6 +3510,10 @@ _hidden void libxl__domain_suspend(libxl__egc *egc,/* used by libxc to suspend the guest during migration */ _hidden void libxl__domain_suspend_callback(void *data); +/* Remus callbacks for restore */ +_hidden void remus_checkpoint_stream_written( +libxl__egc *egc,libxl__stream_write_state *sws,int rc); +/* * Convenience macros.
Signature · 1 line
2.5.0
PATCH v5 2/18 tools/libxl: move remus code into libxl_remus.c
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
After previous refactoring, we are now able to move all remus code into a separate file libxl_remus.c.
Export following functions for internal use:
- Remus callbacks
* libxl__remus_domain_suspend_callback
* libxl__remus_domain_resume_callback
* libxl__remus_domain_save_checkpoint_callback
* libxl__remus_domain_restore_checkpoint_callback
- setup/teardown Remus:
* libxl__remus_setup
* libxl__remus_teardown
--- tools/libxl/Makefile | 2 +- tools/libxl/libxl.c | 69 --------- tools/libxl/libxl_create.c | 27 ---- tools/libxl/libxl_dom.c | 223 --------------------------- tools/libxl/libxl_internal.h | 15 +- tools/libxl/libxl_remus.c | 348 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 362 insertions(+), 322 deletions(-) create mode 100644 tools/libxl/libxl_remus.c
tools/libxl/Makefile +1 -1
@@ -62,7 +62,7 @@ else LIBXL_OBJS-y += libxl_no_convert_callout.o endif -LIBXL_OBJS-y += libxl_remus_device.o libxl_remus_disk_drbd.o +LIBXL_OBJS-y += libxl_remus.o libxl_remus_device.o libxl_remus_disk_drbd.o LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
tools/libxl/libxl.c +0 -69
81 lines not on this page · raw message
tools/libxl/libxl_create.c +0 -27
@@ -688,33 +688,6 @@ static int store_libxl_entry(libxl__gc *gc, uint32_t domid, libxl_device_model_version_to_string(b_info->device_model_version)); } -/*----- remus asynchronous checkpoint callback -----*/ - -static void remus_checkpoint_stream_done ( -libxl__egc *egc,libxl__stream_read_state *srs,int rc); - -static void libxl__remus_domain_restore_checkpoint_callback (void *data) -{ -libxl__save_helper_state *shs = data; -libxl__domain_create_state *dcs = shs->caller_state; -libxl__egc *egc = shs->egc; -STATE_AO_GC (dcs->ao); - -libxl__stream_read_start_checkpoint (egc, &dcs->srs); -} - -static void remus_checkpoint_stream_done ( -libxl__egc *egc,libxl__stream_read_state *stream,int rc) -{ -libxl__xc_domain_saverestore_async_callback_done (egc, &stream->shs, rc); -} - -static void libxl__remus_restore_setup (libxl__egc *egc, -libxl__domain_create_state *dcs) -{ - dcs->srs.checkpoint_callback = remus_checkpoint_stream_done; -} -/*----- main domain creation -----*/ /* We have a linear control flow; only one event callback is
tools/libxl/libxl_dom.c +0 -223
241 lines not on this page · raw message
tools/libxl/libxl_internal.h +13 -2
@@ -3510,9 +3510,20 @@ _hidden void libxl__domain_suspend(libxl__egc *egc,/* used by libxc to suspend the guest during migration */ _hidden void libxl__domain_suspend_callback(void *data); +/* Remus callbacks for save */ +_hidden void libxl__remus_domain_suspend_callback(void *data); +_hidden void libxl__remus_domain_resume_callback(void *data); +_hidden void libxl__remus_domain_save_checkpoint_callback(void *data); +/* Remus setup and teardown*/ +_hidden void libxl__remus_setup(libxl__egc *egc, +libxl__domain_suspend_state *dss); +_hidden void libxl__remus_teardown(libxl__egc *egc, +libxl__domain_suspend_state *dss, +int rc);/* Remus callbacks for restore */ -_hidden void remus_checkpoint_stream_written( -libxl__egc *egc,libxl__stream_write_state *sws,int rc); +_hidden void libxl__remus_domain_restore_checkpoint_callback(void *data); +_hidden void libxl__remus_restore_setup(libxl__egc *egc, +libxl__domain_create_state *dcs);/*
tools/libxl/libxl_remus.c new file +348 -0
348 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 3/18 tools/libxl: move save/restore code into libxl_dom_save.c
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
This is purely code motion.
--- tools/libxl/Makefile | 2 +- tools/libxl/libxl_dom.c | 605 ----------------------------------------- tools/libxl/libxl_dom_save.c | 634 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 635 insertions(+), 606 deletions(-) create mode 100644 tools/libxl/libxl_dom_save.c
tools/libxl/Makefile +1 -1
@@ -103,7 +103,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \ libxl_stream_read.o libxl_stream_write.o \ libxl_save_callout.o _libxl_save_msgs_callout.o \ libxl_qmp.o libxl_event.o libxl_fork.o \ - libxl_dom_suspend.o $(LIBXL_OBJS-y) + libxl_dom_suspend.o libxl_dom_save.o $(LIBXL_OBJS-y) LIBXL_OBJS += libxl_genid.o LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
tools/libxl/libxl_dom.c +0 -605
617 lines not on this page · raw message
tools/libxl/libxl_dom_save.c new file +634 -0
634 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 4/18 libxl/save: Refactor libxl__domain_suspend_state
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
Currently struct libxl__domain_suspend_state contains 2 type of states, one is save state, another is suspend state. This patch separates those two out.
The motivation of this is that COLO will need to do suspend/resume continuously, we need a more common suspend state.
After this change, dss stands for libxl__domain_save_state, dsps stands for libxl__domain_suspend_state.
Also introduce libxl__domain_suspend_init to initialise the libxl__domain_suspend_state.
--- tools/libxl/libxl.c | 10 +- tools/libxl/libxl_create.c | 10 +- tools/libxl/libxl_dom_save.c | 69 +++++-------- tools/libxl/libxl_dom_suspend.c | 217 +++++++++++++++++++++++++-------------- tools/libxl/libxl_internal.h | 62 ++++++----- tools/libxl/libxl_netbuffer.c | 2 +- tools/libxl/libxl_remus.c | 37 ++++--- tools/libxl/libxl_save_callout.c | 2 +- tools/libxl/libxl_stream_write.c | 16 +-- 9 files changed, 241 insertions(+), 184 deletions(-)
tools/libxl/libxl.c +5 -5
@@ -833,7 +833,7 @@ out: }static void remus_failover_cb (libxl__egc *egc, -libxl__domain_suspend_state *dss,int rc); +libxl__domain_save_state *dss,int rc);/* TODO: Explicit Checkpoint acknowledgements via recv_fd. */ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,
@@ -841,7 +841,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, const libxl_asyncop_how *ao_how) {AO_CREATE (ctx, domid, ao_how); -libxl__domain_suspend_state *dss; +libxl__domain_save_state *dss;int rc;libxl_domain_type type =libxl__domain_type (gc, domid);
@@ -889,7 +889,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, }static void remus_failover_cb (libxl__egc *egc, -libxl__domain_suspend_state *dss,int rc) +libxl__domain_save_state *dss,int rc) {STATE_AO_GC (dss->ao);/*
@@ -901,7 +901,7 @@ static void remus_failover_cb(libxl__egc *egc, }static void domain_suspend_cb (libxl__egc *egc, -libxl__domain_suspend_state *dss,int rc) +libxl__domain_save_state *dss,int rc) {STATE_AO_GC (dss->ao);int flrc;
@@ -926,7 +926,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags, goto out_err; } -libxl__domain_suspend_state *dss; +libxl__domain_save_state *dss;GCNEW (dss); dss->ao = ao;
tools/libxl/libxl_create.c +5 -5
@@ -1538,7 +1538,7 @@ typedef struct {typedef struct {libxl__app_domain_create_state cdcs;libxl__domain_destroy_state dds; -libxl__domain_suspend_state dss; +libxl__domain_save_state dss;char *toolstack_buf;uint32_t toolstack_len; }libxl__domain_soft_reset_state ;
@@ -1633,7 +1633,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx,libxl__app_domain_create_state *cdcs;libxl__domain_create_state *dcs;libxl__domain_build_state *state; -libxl__domain_suspend_state *dss; +libxl__domain_save_state *dss;char *dom_path, *xs_store_mfn, *xs_console_mfn;uint32_t domid_out;int rc;
@@ -1677,8 +1677,8 @@ static int do_domain_soft_reset(libxl_ctx *ctx, dss->ao = ao; dss->domid = domid_soft_reset; - dss->dm_savefile =GCSPRINTF (LIBXL_DEVICE_MODEL_SAVE_FILE ".%d" , - domid_soft_reset); + dss->dsps.dm_savefile =GCSPRINTF (LIBXL_DEVICE_MODEL_SAVE_FILE ".%d" , + domid_soft_reset); rc =libxl__save_emulator_xenstore_data (dss, &srs->toolstack_buf, &srs->toolstack_len);
@@ -1687,7 +1687,7 @@ static int do_domain_soft_reset(libxl_ctx *ctx, goto out; } - rc =libxl__domain_suspend_device_model (gc, dss); + rc =libxl__domain_suspend_device_model (gc, &dss->dsps);if (rc) {LOG (ERROR ,"failed to suspend device model." ); goto out;
tools/libxl/libxl_dom_save.c +24 -45
188 lines not on this page · raw message
tools/libxl/libxl_dom_suspend.c +138 -79
411 lines not on this page · raw message
tools/libxl/libxl_internal.h +39 -23
132 lines not on this page · raw message
tools/libxl/libxl_netbuffer.c +1 -1
@@ -41,7 +41,7 @@ int libxl__netbuffer_enabled(libxl__gc *gc)int init_subkind_nic (libxl__remus_devices_state *rds) {int rc, ret; -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (rds->ao);
tools/libxl/libxl_remus.c +20 -17
@@ -28,7 +28,7 @@ static void remus_checkpoint_stream_written( libxl__egc *egc, libxl__stream_write_state *sws, int rc);void libxl__remus_setup (libxl__egc *egc, -libxl__domain_suspend_state *dss) +libxl__domain_save_state *dss) {/* Convenience aliases */ libxl__remus_devices_state *const rds = &dss->rds;
@@ -63,7 +63,7 @@ out:static void remus_setup_done (libxl__egc *egc,libxl__remus_devices_state *rds,int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (dss->ao);if (!rc) {
@@ -80,7 +80,7 @@ static void remus_setup_done(libxl__egc *egc,static void remus_setup_failed (libxl__egc *egc,libxl__remus_devices_state *rds,int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (dss->ao);if (rc)
@@ -94,7 +94,7 @@ static void remus_teardown_done(libxl__egc *egc,libxl__remus_devices_state *rds, int rc);void libxl__remus_teardown (libxl__egc *egc, -libxl__domain_suspend_state *dss, +libxl__domain_save_state *dss,int rc) {EGC_GC ;
@@ -109,7 +109,7 @@ static void remus_teardown_done(libxl__egc *egc, libxl__remus_devices_state *rds, int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (dss->ao);if (rc)
@@ -122,7 +122,7 @@ static void remus_teardown_done(libxl__egc *egc,/*---------------------- remus callbacks (save) -----------------------*/ static void remus_domain_suspend_callback_common_done (libxl__egc *egc, -libxl__domain_suspend_state *dss,int ok); +libxl__domain_suspend_state *dsps,int ok);static void remus_devices_postsuspend_cb (libxl__egc *egc,libxl__remus_devices_state *rds,int rc);
@@ -134,15 +134,18 @@ void libxl__remus_domain_suspend_callback(void *data) {libxl__save_helper_state *shs = data;libxl__egc *egc = shs->egc; -libxl__domain_suspend_state *dss = shs->caller_state; +libxl__domain_save_state *dss = shs->caller_state; +libxl__domain_suspend_state *dsps = &dss->dsps; - dss->callback_common_done = remus_domain_suspend_callback_common_done; -libxl__domain_suspend (egc, dss); + dsps->callback_common_done = remus_domain_suspend_callback_common_done; +libxl__domain_suspend (egc, dsps); }static void remus_domain_suspend_callback_common_done (libxl__egc *egc, -libxl__domain_suspend_state *dss,int rc) +libxl__domain_suspend_state *dsps,int rc) { +libxl__domain_save_state *dss =CONTAINER_OF (dsps, *dss, dsps); +if (rc) goto out;
@@ -160,7 +163,7 @@ static void remus_devices_postsuspend_cb(libxl__egc *egc, libxl__remus_devices_state *rds, int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);if (rc) goto out;
@@ -177,7 +180,7 @@ void libxl__remus_domain_resume_callback(void *data) {libxl__save_helper_state *shs = data;libxl__egc *egc = shs->egc; -libxl__domain_suspend_state *dss = shs->caller_state; +libxl__domain_save_state *dss = shs->caller_state;STATE_AO_GC (dss->ao);libxl__remus_devices_state *const rds = &dss->rds;
@@ -189,7 +192,7 @@ static void remus_devices_preresume_cb(libxl__egc *egc, libxl__remus_devices_state *rds, int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (dss->ao);if (rc)
@@ -220,7 +223,7 @@ static void remus_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev,void libxl__remus_domain_save_checkpoint_callback (void *data) {libxl__save_helper_state *shs = data; -libxl__domain_suspend_state *dss = shs->caller_state; +libxl__domain_save_state *dss = shs->caller_state;libxl__egc *egc = shs->egc;STATE_AO_GC (dss->ao);
@@ -230,7 +233,7 @@ void libxl__remus_domain_save_checkpoint_callback(void *data)static void remus_checkpoint_stream_written (libxl__egc *egc,libxl__stream_write_state *sws,int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (sws, *dss, sws); +libxl__domain_save_state *dss =CONTAINER_OF (sws, *dss, sws);/* Convenience aliases */ libxl__remus_devices_state *const rds = &dss->rds;
@@ -255,7 +258,7 @@ static void remus_devices_commit_cb(libxl__egc *egc, libxl__remus_devices_state *rds, int rc) { -libxl__domain_suspend_state *dss =CONTAINER_OF (rds, *dss, rds); +libxl__domain_save_state *dss =CONTAINER_OF (rds, *dss, rds);STATE_AO_GC (dss->ao);
@@ -290,7 +293,7 @@ static void remus_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev,const struct timeval *requested_abs, int rc) { - libxl__domain_suspend_state *dss = + libxl__domain_save_state *dss =CONTAINER_OF (ev, *dss, checkpoint_timeout);STATE_AO_GC (dss->ao);
tools/libxl/libxl_save_callout.c +1 -1
@@ -75,7 +75,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, argnums, ARRAY_SIZE(argnums)); } -void libxl__xc_domain_save (libxl__egc *egc,libxl__domain_suspend_state *dss, +void libxl__xc_domain_save (libxl__egc *egc,libxl__domain_save_state *dss,libxl__save_helper_state *shs) {STATE_AO_GC (dss->ao);
tools/libxl/libxl_stream_write.c +8 -8
@@ -216,7 +216,7 @@ void libxl__stream_write_start(libxl__egc *egc, libxl__stream_write_state *stream) {libxl__datacopier_state *dc = &stream->dc; -libxl__domain_suspend_state *dss = stream->dss; +libxl__domain_save_state *dss = stream->dss;STATE_AO_GC (stream->ao);struct libxl__sr_hdr hdr;int rc =0 ;
@@ -324,7 +324,7 @@ static void libxc_header_done(libxl__egc *egc,void libxl__xc_domain_save_done (libxl__egc *egc,void *dss_void,int rc,int retval,int errnoval) { -libxl__domain_suspend_state *dss = dss_void; +libxl__domain_save_state *dss = dss_void;libxl__stream_write_state *stream = &dss->sws;STATE_AO_GC (dss->ao);
@@ -333,10 +333,10 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void,if (retval) {LOGEV (ERROR , errnoval,"saving domain: %s" , - dss->guest_responded ? + dss->dsps.guest_responded ?"domain responded to suspend request" :"domain did not respond to suspend request" ); -if (!dss->guest_responded) +if (!dss->dsps.guest_responded) rc =ERROR_GUEST_TIMEDOUT ;else if (dss->rc) rc = dss->rc;
@@ -361,7 +361,7 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void,static void write_emulator_xenstore_record (libxl__egc *egc,libxl__stream_write_state *stream) { -libxl__domain_suspend_state *dss = stream->dss; +libxl__domain_save_state *dss = stream->dss;STATE_AO_GC (stream->ao);struct libxl__sr_rec_hdr rec;int rc;
@@ -400,7 +400,7 @@ static void write_emulator_xenstore_record(libxl__egc *egc,static void emulator_xenstore_record_done (libxl__egc *egc,libxl__stream_write_state *stream) { -libxl__domain_suspend_state *dss = stream->dss; +libxl__domain_save_state *dss = stream->dss;if (dss->type ==LIBXL_DOMAIN_TYPE_HVM )write_emulator_context_record (egc, stream);
@@ -415,7 +415,7 @@ static void emulator_xenstore_record_done(libxl__egc *egc,static void write_emulator_context_record (libxl__egc *egc,libxl__stream_write_state *stream) { -libxl__domain_suspend_state *dss = stream->dss; +libxl__domain_save_state *dss = stream->dss;libxl__datacopier_state *dc = &stream->emu_dc;STATE_AO_GC (stream->ao);struct libxl__sr_rec_hdr *rec = &stream->emu_rec_hdr;
@@ -430,7 +430,7 @@ static void write_emulator_context_record(libxl__egc *egc, }/* Convenience aliases */ -const char *const filename = dss->dm_savefile; +const char *const filename = dss->dsps.dm_savefile;libxl__carefd_begin ();int readfd =open (filename,O_RDONLY );
Signature · 1 line
2.5.0
PATCH v5 5/18 tools/libxc: support to resume uncooperative HVM guests
In reply to Wen CongyangBefor this patch:
1. suspend
a. PVHVM and PV: we use the same way to suspend the guest (send the suspend
request to the guest). If the guest doesn't support evtchn, the xenstore variant will be used, suspending the guest via XenBus control node.
b. pure HVM: we call xc_domain_shutdown(..., SHUTDOWN_suspend) to suspend
the guest
2. Resume:
a. fast path
In this case, we don't change the guest's state. And we will call libxl__domain_resume(..., 1) to resume the guest.
PV: modify the return code to 1, and than call the domctl
XEN_DOMCTL_resumedomain
PVHVM: same with PV
pure HVM: do nothing in modify_returncode, and than call the domctl:
XEN_DOMCTL_resumedomain
b. slow
Used when the guest's state have been changed. And we will call libxl__domain_resume(..., 0) to resume the guest.
PV: update start info, and reset all secondary CPU states. Than call
the domctl: XEN_DOMCTL_resumedomain
PVHVM: can not be resumed. You will get the following error message:
"Cannot resume uncooperative HVM guests"
purt HVM: same with PVHVM
After this patch:
1. suspend
unchanged
2. Resume
a. fast path:
unchanged
b. slow
PV: unchanged
PVHVM: call XEN_DOMCTL_resumedomain to resume the guest. Because we
don't modify the return code, the PV driver will disconnect and reconnect. I am not sure if we should update start info and reset all secondary CPU states.
Pure HVM: call XEN_DOMCTL_resumedomain to resume the guest.
Under COLO, we will update the guest's state(modify memory, cpu's registers, device status...). In this case, we cannot use the fast path to resume it. Keep the return code 0, and use a slow path to resume the guest. While resuming HVM using slow path is not supported currently, this patch is to make the resume call do not fail.
--- tools/libxc/xc_resume.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
tools/libxc/xc_resume.c +20 -4
@@ -108,6 +108,25 @@ static int xc_domain_resume_cooperative(xc_interface *xch, uint32_t domid)return do_domctl (xch, &domctl); } +static int xc_domain_resume_hvm (xc_interface *xch,uint32_t domid) +{ +DECLARE_DOMCTL ; + +/* +* This domctl XEN_DOMCTL_resumedomain just unpause each vcpu. After +* this domctl, the guest will run. +* +* If it is PVHVM, the guest called the hypercall HYPERVISOR_sched_op +* to suspend itself. We don't modify the return code, so the PV driver +* will disconnect and reconnect. +* +* If it is a HVM, the guest will continue running. +*/ + domctl.cmd = XEN_DOMCTL_resumedomain; + domctl.domain = domid; +return do_domctl (xch, &domctl); +} +static int xc_domain_resume_any (xc_interface *xch,uint32_t domid) {DECLARE_DOMCTL ;
@@ -137,10 +156,7 @@ static int xc_domain_resume_any(xc_interface *xch, uint32_t domid)*/ #if defined(__i386__) || defined(__x86_64__)if ( info.hvm ) - { -ERROR ("Cannot resume uncooperative HVM guests" ); -return rc; - } +return xc_domain_resume_hvm (xch, domid);if (xc_domain_get_guest_width (xch, domid, &dinfo->guest_width) !=0 ) {
Signature · 1 line
2.5.0
PATCH v5 6/18 tools/libxl: introduce enum type libxl_checkpointed_stream
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
introduce enum type libxl_checkpointed_stream in IDL. rename the last argument of migrate_receive from "remus" to "checkpointed" since the semantics of this parameter has changed.
NOTE:
libxl_domain_restore_params isn't changed here, checkpointed_stream is still an int.
--- tools/libxl/libxl.h | 7 +++++++ tools/libxl/libxl_types.idl | 5 +++++ tools/libxl/xl_cmdimpl.c | 18 ++++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-)
tools/libxl/libxl.h +7 -0
@@ -867,6 +867,13 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);*/ #define LIBXL_HAVE_DEVICE_MODEL_VERSION_NONE 1 +/* +* LIBXL_HAVE_CHECKPOINTED_STREAM +* +* If this is defined, then libxl_checkpointed_stream exists. +*/ +#define LIBXL_HAVE_CHECKPOINTED_STREAM 1 +typedef char **libxl_string_list ;void libxl_string_list_dispose (libxl_string_list *sl);int libxl_string_list_length (const libxl_string_list *sl);
tools/libxl/libxl_types.idl +5 -0
@@ -228,6 +228,11 @@ libxl_hdtype = Enumeration("hdtype", [ (2, "AHCI"), ], init_val = "LIBXL_HDTYPE_IDE") +libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ + (0, "NONE"), + (1, "REMUS"), + ]) + # # Complex libxl types #
tools/libxl/xl_cmdimpl.c +12 -6
@@ -4424,7 +4424,8 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, }static void migrate_receive (int debug,int daemonize,int monitor, -int send_fd,int recv_fd,int remus) +int send_fd,int recv_fd, +libxl_checkpointed_stream checkpointed) {uint32_t domid;int rc, rc2;
@@ -4449,7 +4450,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, dom_info.paused =1 ; dom_info.migrate_fd = recv_fd; dom_info.migration_domname_r = &migration_domname; - dom_info.checkpointed_stream = remus; + dom_info.checkpointed_stream = checkpointed; rc =create_domain (&dom_info);if (rc <0 ) {
@@ -4460,7 +4461,8 @@ static void migrate_receive(int debug, int daemonize, int monitor, domid = rc; -if (remus) { +switch (checkpointed) { +case LIBXL_CHECKPOINTED_STREAM_REMUS :/* If we are here, it means that the sender (primary) has crashed. * TODO: Split-Brain Check. */
@@ -4493,6 +4495,9 @@ static void migrate_receive(int debug, int daemonize, int monitor, common_domname, domid, rc);exit (rc ? -ERROR_FAIL :0 ); +default : +/* do nothing */ +break ; } fprintf(stderr, "migration target: Transfer complete,"
@@ -4630,7 +4635,8 @@ int main_restore(int argc, char **argv)int main_migrate_receive (int argc,char **argv) { -int debug =0 , daemonize =1 , monitor =1 , remus =0 ; +int debug =0 , daemonize =1 , monitor =1 ; +libxl_checkpointed_stream checkpointed =LIBXL_CHECKPOINTED_STREAM_NONE ;int opt; SWITCH_FOREACH_OPT(opt, "Fedr", NULL, "migrate-receive", 0) {
@@ -4645,7 +4651,7 @@ int main_migrate_receive(int argc, char **argv) debug =1 ;break ;case 'r' : - remus =1 ; + checkpointed =LIBXL_CHECKPOINTED_STREAM_REMUS ;break ; }
@@ -4655,7 +4661,7 @@ int main_migrate_receive(int argc, char **argv) }migrate_receive (debug, daemonize, monitor,STDOUT_FILENO ,STDIN_FILENO , - remus); + checkpointed);return 0 ; }
Signature · 1 line
2.5.0
PATCH v5 7/18 migration/save: pass checkpointed_stream from libxl to libxc
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
Pass checkpointed_stream from libxl to libxc.
It won't affact legacy migration because legacy migration won't use this param.
--- tools/libxc/include/xenguest.h | 6 ++++-- tools/libxc/xc_nomigrate.c | 3 ++- tools/libxc/xc_sr_common.h | 12 +++++++++++- tools/libxc/xc_sr_save.c | 16 +++++++++------- tools/libxl/libxl.c | 2 ++ tools/libxl/libxl_dom_save.c | 11 ++++++++--- tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_save_callout.c | 2 +- tools/libxl/libxl_save_helper.c | 3 ++- tools/libxl/libxl_types.idl | 1 + 10 files changed, 41 insertions(+), 16 deletions(-)
tools/libxc/include/xenguest.h +4 -2
@@ -29,7 +29,6 @@#define XCFLAGS_HVM (1 << 2)#define XCFLAGS_STDVGA (1 << 3)#define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4) -#define XCFLAGS_CHECKPOINTED (1 << 5)#define X86_64_B_SIZE 64#define X86_32_B_SIZE 32
@@ -76,11 +75,14 @@ struct save_callbacks {* @parm xch a handle to an open hypervisor interface * @parm fd the file descriptor to save a domain to * @parm dom the id of the domain +* @param checkpointed_stream MIG_STREAM_NONE if the far end of the stream +* doesn't use checkpointing * @return 0 on success, -1 on failure */ int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags/* XCFLAGS_xxx */ , -struct save_callbacks * callbacks,int hvm); +struct save_callbacks * callbacks,int hvm, +int checkpointed_stream);/* callbacks provided by xc_domain_restore */ struct restore_callbacks {
tools/libxc/xc_nomigrate.c +2 -1
@@ -22,7 +22,8 @@int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +int checkpointed_stream) { errno =ENOSYS ;return -1 ;
tools/libxc/xc_sr_common.h +11 -1
@@ -171,6 +171,16 @@ struct xc_sr_contextxc_dominfo_t dominfo; +/* +* migration stream +* 0: Plain VM +* 1: Remus +*/ +enum { +MIG_STREAM_NONE ,/* plain stream */ +MIG_STREAM_REMUS , + } migration_stream; +union /* Common save or restore data. */ { struct /* Save data. */
@@ -182,7 +192,7 @@ struct xc_sr_contextbool live;/* Plain VM, or checkpoints over time. */ -bool checkpointed; +int checkpointed;/* Further debugging information in the stream. */ bool debug;
tools/libxc/xc_sr_save.c +9 -7
@@ -628,7 +628,8 @@ static int send_domain_memory_live(struct xc_sr_context *ctx)if ( rc ) goto out; -if ( ctx->save.debug && !ctx->save.checkpointed ) +if ( ctx->save.debug && + ctx->save.checkpointed !=MIG_STREAM_NONE ) { rc =verify_frames (ctx);if ( rc )
@@ -753,7 +754,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( ctx->save.live ) rc =send_domain_memory_live (ctx); -else if ( ctx->save.checkpointed ) +else if ( ctx->save.checkpointed !=MIG_STREAM_NONE ) rc =send_domain_memory_checkpointed (ctx);else rc =send_domain_memory_nonlive (ctx);
@@ -773,7 +774,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; -if ( ctx->save.checkpointed ) +if ( ctx->save.checkpointed !=MIG_STREAM_NONE ) {/* * We have now completed the initial live portion of the checkpoint
@@ -790,9 +791,9 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type) rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 ) - ctx->save.checkpointed = false; + ctx->save.checkpointed =MIG_STREAM_NONE ; } - }while ( ctx->save.checkpointed ); + }while ( ctx->save.checkpointed !=MIG_STREAM_NONE );xc_report_progress_single (xch,"End of stream" );
@@ -822,7 +823,8 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags, -struct save_callbacks * callbacks,int hvm) +struct save_callbacks * callbacks,int hvm, +int checkpointed_stream) {struct xc_sr_context ctx = {
@@ -834,7 +836,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.callbacks = callbacks; ctx.save.live = !!(flags &XCFLAGS_LIVE ); ctx.save.debug = !!(flags &XCFLAGS_DEBUG ); - ctx.save.checkpointed = !!(flags &XCFLAGS_CHECKPOINTED ); + ctx.save.checkpointed = checkpointed_stream;/* * TODO: Find some time to better tweak the live migration algorithm.
tools/libxl/libxl.c +2 -0
@@ -877,6 +877,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, dss->live =1 ; dss->debug =0 ; dss->remus = info; + dss->checkpointed_stream =LIBXL_CHECKPOINTED_STREAM_REMUS ;assert (info);
@@ -937,6 +938,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags, dss->type = type; dss->live = flags &LIBXL_SUSPEND_LIVE ; dss->debug = flags &LIBXL_SUSPEND_DEBUG ; + dss->checkpointed_stream =LIBXL_CHECKPOINTED_STREAM_NONE ; rc = libxl__fd_flags_modify_save(gc, dss->fd, ~(O_NONBLOCK|O_NDELAY), 0,
tools/libxl/libxl_dom_save.c +8 -3
@@ -338,6 +338,12 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss)unsigned int nr_vnodes =0 , nr_vmemranges =0 , nr_vcpus =0 ;libxl__domain_suspend_state *dsps = &dss->dsps; +if (dss->checkpointed_stream !=LIBXL_CHECKPOINTED_STREAM_NONE && !r_info) { +LOG (ERROR ,"Migration stream is checkpointed, but there's no " +"checkpoint info!" ); + goto out; + } + dss->rc =0 ;logdirty_init (&dss->logdirty); dsps->ao = ao;
@@ -376,15 +382,14 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) goto out; } -if (r_info !=NULL ) { +if (dss->checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_REMUS ) { dss->interval = r_info->interval; - dss->xcflags |=XCFLAGS_CHECKPOINTED ;if (libxl_defbool_val (r_info->compression)) dss->xcflags |=XCFLAGS_CHECKPOINT_COMPRESS ; }memset (callbacks,0 ,sizeof (*callbacks)); -if (r_info !=NULL ) { +if (dss->checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_REMUS ) { callbacks->suspend = libxl__remus_domain_suspend_callback; callbacks->postcopy = libxl__remus_domain_resume_callback; callbacks->checkpoint = libxl__remus_domain_save_checkpoint_callback;
tools/libxl/libxl_internal.h +1 -0
@@ -3108,6 +3108,7 @@ struct libxl__domain_save_state {libxl_domain_type type;int live;int debug; +int checkpointed_stream;const libxl_domain_remus_info *remus;/* private */ int rc;
tools/libxl/libxl_save_callout.c +1 -1
@@ -85,7 +85,7 @@ void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_save_state *dss,const unsigned long argnums[] = { dss->domid,0 ,0 , dss->xcflags, dss->hvm, - cbflags, + cbflags, dss->checkpointed_stream, }; shs->ao = ao;
tools/libxl/libxl_save_helper.c +2 -1
@@ -253,6 +253,7 @@ int main(int argc, char **argv)uint32_t flags =strtoul (NEXTARG ,0 ,10 );int hvm =atoi (NEXTARG );unsigned cbflags =strtoul (NEXTARG ,0 ,10 ); +int checkpointed_stream =strtoul (NEXTARG ,0 ,10 );assert (!*++argv);helper_setcallbacks_save (&helper_save_callbacks, cbflags);
@@ -261,7 +262,7 @@ int main(int argc, char **argv)setup_signals (save_signal_handler); r =xc_domain_save (xch, io_fd, dom, max_iters, max_factor, flags, - &helper_save_callbacks, hvm); + &helper_save_callbacks, hvm, checkpointed_stream);complete (r); }else if (!strcmp (mode,"--restore-domain" )) {
tools/libxl/libxl_types.idl +1 -0
@@ -228,6 +228,7 @@ libxl_hdtype = Enumeration("hdtype", [ (2, "AHCI"), ], init_val = "LIBXL_HDTYPE_IDE") +# Consistent with the values defined for migration_stream libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (0, "NONE"), (1, "REMUS"),
Signature · 1 line
2.5.0
Re: [PATCH v5 COLOPre 07/18] migration/save: pass checkpointed_stream from libxl to libxc
Quoted 5 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
Pass
checkpointed_streamfrom libxl to libxc.
It won't affact legacy migration because legacy migration won't use this param.
Ah, that is why you wanted to keep it as in 'int' in the struct domain_create. You may want to update patch #6 to mention that you need it to pass it on libxc.
..snip..
tools/libxc/xc_sr_save.c int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, · line 839
Quoted 6 lines
tools/libxc/xc_sr_save.c +1
-1@@ -834,7 +836,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.callbacks = callbacks; ctx.save.live = !!(flags &XCFLAGS_LIVE ); ctx.save.debug = !!(flags &XCFLAGS_DEBUG ); - ctx.save.checkpointed = !!(flags &XCFLAGS_CHECKPOINTED ); + ctx.save.checkpointed = checkpointed_stream;
Should you have an check to make sure they are the right enums?
/* If altering migration_stream update this assert too. */ assert(checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_NONE ||
checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_REMUS);
.. snip..
tools/libxl/libxl_types.idl libxl_hdtype = Enumeration("hdtype", [ · line 231
Quoted 9 lines
tools/libxl/libxl_types.idl +1
-0@@ -228,6 +228,7 @@ libxl_hdtype = Enumeration("hdtype", [ (2, "AHCI"), ], init_val = "LIBXL_HDTYPE_IDE") +# Consistent with the values defined for migration_stream
s/stream/stream./
Quoted 13 lines
tools/libxl/libxl_types.idl +0
-0libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (0, "NONE"), (1, "REMUS"),Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 COLOPre 07/18] migration/save: pass checkpointed_stream from libxl to libxc
Quoted 22 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
Pass
checkpointed_streamfrom libxl to libxc.
It won't affact legacy migration because legacy migration won't use this param.Ah, that is why you wanted to keep it as in 'int' in the struct
domain_create. You may want to update patch #6 to mention that you need it to pass it on libxc...snip..
tools/libxc/xc_sr_save.c int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, · line 839
Quoted 6 lines
tools/libxc/xc_sr_save.c +1
-1@@ -834,7 +836,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.callbacks = callbacks; ctx.save.live = !!(flags &XCFLAGS_LIVE ); ctx.save.debug = !!(flags &XCFLAGS_DEBUG ); - ctx.save.checkpointed = !!(flags &XCFLAGS_CHECKPOINTED ); + ctx.save.checkpointed = checkpointed_stream;Should you have an check to make sure they are the right enums?
Quoted 3 lines
/* If altering
migration_streamupdate this assert too. */ assert(checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_NONE||checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_REMUS);
Oops.
That should have been MIG_STREAM_REMUS and MIG_STREAM_NONE.
And sorry about responding under the wrong patchset (v5) instead of the (v6)! They look the same so it ought to be ok?
Quoted 29 lines
.. snip..
tools/libxl/libxl_types.idl libxl_hdtype = Enumeration("hdtype", [ · line 231
Quoted 9 lines
tools/libxl/libxl_types.idl +1
-0@@ -228,6 +228,7 @@ libxl_hdtype = Enumeration("hdtype", [ (2, "AHCI"), ], init_val = "LIBXL_HDTYPE_IDE") +# Consistent with the values defined for migration_streams/stream/stream./
Quoted 13 lines
tools/libxl/libxl_types.idl +0
-0libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (0, "NONE"), (1, "REMUS"),Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 COLOPre 07/18] migration/save: pass checkpointed_stream from libxl to libxc
Quoted 27 lines · Konrad Rzeszutek Wilk
Quoted 22 lines · Konrad Rzeszutek Wilk
Quoted 5 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
Pass
checkpointed_streamfrom libxl to libxc.
It won't affact legacy migration because legacy migration won't use this param.Ah, that is why you wanted to keep it as in 'int' in the struct
domain_create. You may want to update patch #6 to mention that you need it to pass it on libxc...snip..
tools/libxc/xc_sr_save.c int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, · line 839
Quoted 6 lines
tools/libxc/xc_sr_save.c +1
-1@@ -834,7 +836,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.callbacks = callbacks; ctx.save.live = !!(flags &XCFLAGS_LIVE ); ctx.save.debug = !!(flags &XCFLAGS_DEBUG ); - ctx.save.checkpointed = !!(flags &XCFLAGS_CHECKPOINTED ); + ctx.save.checkpointed = checkpointed_stream;Should you have an check to make sure they are the right enums?
Quoted 3 lines
/* If altering
migration_streamupdate this assert too. */ assert(checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_NONE||checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_REMUS);
Quoted 6 lines
Oops.
That should have been
MIG_STREAM_REMUSandMIG_STREAM_NONE.And sorry about responding under the wrong patchset (v5) instead of the (v6)! They look the same so it ought to be ok?
It is OK. I will update it in the next version.
Thanks
Wen Congyang
Quoted 33 lines
Quoted 12 lines
.. snip..
Quoted 8 lines
tools/libxl/libxl_types.idl +0
-0@@ -228,6 +228,7 @@ libxl_hdtype = Enumeration("hdtype", [ (2, "AHCI"), ], init_val = "LIBXL_HDTYPE_IDE")Quoted 17 lines
tools/libxl/libxl_types.idl libxl_hdtype = Enumeration("hdtype", [ · line 231
Quoted 1 line
tools/libxl/libxl_types.idl +1
-0+# Consistent with the values defined for migration_streams/stream/stream./
Quoted 13 lines
tools/libxl/libxl_types.idl +0
-0libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (0, "NONE"), (1, "REMUS"),Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel.
PATCH v5 8/18 tools/libxl: introduce libxl__domain_restore_device_model to load qemu state
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
In normal migration, the qemu state was passed to qemu as a parameter. With COLO, Secondary vm is running. So we will do the following steps at every checkpoint:
1. suspend both primary vm and secondary vm
2. sync the state
3. resume both primary vm and secondary vm
Primary will send qemu's state in step2, and
Secondary's qemu should read it and restore the state before it is resumed. We can not pass the state to qemu as a parameter because Secondary QEMU already started at this point, so we introduce libxl__domain_restore_device_model() to do it.
This API should be called before resuming secondary vm.
--- tools/libxl/libxl_dom_save.c | 20 ++++++++++++++++++++ tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_qmp.c | 10 ++++++++++ 3 files changed, 34 insertions(+)
tools/libxl/libxl_dom_save.c +20 -0
@@ -609,6 +609,26 @@ int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,return rc; } +int libxl__domain_restore_device_model (libxl__gc *gc,uint32_t domid, +const char *restore_file) +{ +int rc; + +switch (libxl__device_model_version_running (gc, domid)) { +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL : +/* not supported now */ + rc =ERROR_INVAL ; +break ; +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : + rc =libxl__qmp_restore (gc, domid, restore_file); +break ; +default : + rc =ERROR_INVAL ; + } + +return rc; +} +/* * Local variables: * mode: C
tools/libxl/libxl_internal.h +4 -0
@@ -1115,6 +1115,8 @@ _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid, const char *old_name, const char *new_name, xs_transaction_t trans); +_hidden int libxl__domain_restore_device_model(libxl__gc *gc, uint32_t domid, +const char *restore_file); _hidden int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid); _hidden const char *libxl__userdata_path(libxl__gc *gc, uint32_t domid,
@@ -1758,6 +1760,8 @@ _hidden int libxl__qmp_stop(libxl__gc *gc, int domid); _hidden int libxl__qmp_resume(libxl__gc *gc, int domid);/* Save current QEMU state into fd. */ _hidden int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename); +/* Load current QEMU state from fd. */ +_hidden int libxl__qmp_restore(libxl__gc *gc, int domid, const char *filename);/* Set dirty bitmap logging status */ _hidden int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable); _hidden int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, const libxl_device_disk *disk);
tools/libxl/libxl_qmp.c +10 -0
@@ -905,6 +905,16 @@ int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename) NULL, NULL); } +int libxl__qmp_restore (libxl__gc *gc,int domid,const char *state_file) +{ +libxl__json_object *args =NULL ; + +qmp_parameters_add_string (gc, &args,"filename" , state_file); + +return qmp_run_command (gc, domid,"xen-load-devices-state" , args, +NULL ,NULL ); +} +static int qmp_change (libxl__gc *gc,libxl__qmp_handler *qmp,char *device,char *target,char *arg) {
Signature · 1 line
2.5.0
Re: [PATCH v5 COLOPre 08/18] tools/libxl: introduce libxl__domain_restore_device_model to load qemu state
Quoted 3 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
In normal migration, the qemu state was passed to qemu as a parameter.
/was/is/
Quoted 7 lines
With COLO, Secondary vm is running. So we will do the following steps at every checkpoint:
1. suspend both primary vm and secondary vm
2. sync the state
3. resume both primary vm and secondary vm
Primary will send qemu's state in step2, and
Secondary's qemu should read it and restore the state before it
s/Secondary/secondary/
Quoted 2 lines
is resumed. We can not pass the state to qemu as a parameter because Secondary QEMU already started at this point, so we introduce
s/Secondary/secondary/
Quoted 2 lines
libxl__domain_restore_device_model()to do it. This API should be called before resuming secondary vm.
s/before/MUST/
Quoted 16 lines
Signed-off-by Yang Hongyang <[email protected]>Signed-off-by Wen Congyang <[email protected]>Cc Anthony Perard <[email protected]>--- tools/libxl/libxl_dom_save.c | 20 ++++++++++++++++++++ tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_qmp.c | 10 ++++++++++ 3 files changed, 34 insertions(+)tools/libxl/libxl_dom_save.c +0
-0@@ -609,6 +609,26 @@ int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,return rc;
tools/libxl/libxl_dom_save.c int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs, · line 619
Quoted 10 lines
tools/libxl/libxl_dom_save.c +8
-0} +int libxl__domain_restore_device_model (libxl__gc *gc,uint32_t domid, +const char *restore_file) +{ +int rc; + +switch (libxl__device_model_version_running (gc, domid)) { +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL : +/* not supported now */
Perhaps: Will never be supported.
Quoted 12 lines
tools/libxl/libxl_dom_save.c +12
-0+ rc =ERROR_INVAL ; +break ; +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : + rc =libxl__qmp_restore (gc, domid, restore_file); +break ; +default : + rc =ERROR_INVAL ; + } + +return rc; +} +
Re: [PATCH v5 COLOPre 08/18] tools/libxl: introduce libxl__domain_restore_device_model to load qemu state
Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
In normal migration, the qemu state was passed to qemu as a parameter.
/was/is/
Quoted 7 lines
With COLO, Secondary vm is running. So we will do the following steps at every checkpoint:
1. suspend both primary vm and secondary vm
2. sync the state
3. resume both primary vm and secondary vm
Primary will send qemu's state in step2, and
Secondary's qemu should read it and restore the state before its/Secondary/secondary/
Quoted 8 lines
Quoted 2 lines
is resumed. We can not pass the state to qemu as a parameter because Secondary QEMU already started at this point, so we introduce
s/Secondary/secondary/
Quoted 2 lines
libxl__domain_restore_device_model()to do it. This API should be called before resuming secondary vm.s/before/MUST/
s/should/MUST/?
Thanks
Wen Congyang
Quoted 46 lines
Quoted 17 lines
Signed-off-by Yang Hongyang <[email protected]>Signed-off-by Wen Congyang <[email protected]>Cc Anthony Perard <[email protected]>--- tools/libxl/libxl_dom_save.c | 20 ++++++++++++++++++++ tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_qmp.c | 10 ++++++++++ 3 files changed, 34 insertions(+)tools/libxl/libxl_dom_save.c +0
-0@@ -609,6 +609,26 @@ int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,return rc;tools/libxl/libxl_dom_save.c int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs, · line 619
Quoted 10 lines
tools/libxl/libxl_dom_save.c +8
-0} +int libxl__domain_restore_device_model (libxl__gc *gc,uint32_t domid, +const char *restore_file) +{ +int rc; + +switch (libxl__device_model_version_running (gc, domid)) { +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL : +/* not supported now */ Perhaps: Will never be supported.
tools/libxl/libxl_dom_save.c int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs, · line 631
Quoted 12 lines
tools/libxl/libxl_dom_save.c +12
-0+ rc =ERROR_INVAL ; +break ; +case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : + rc =libxl__qmp_restore (gc, domid, restore_file); +break ; +default : + rc =ERROR_INVAL ; + } + +return rc; +} +.
Re: [PATCH v5 COLOPre 08/18] tools/libxl: introduce libxl__domain_restore_device_model to load qemu state
Quoted 20 lines · Wen Congyang
Quoted 19 lines · Konrad Rzeszutek Wilk
Quoted 3 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
In normal migration, the qemu state was passed to qemu as a parameter.
/was/is/
Quoted 7 lines
With COLO, Secondary vm is running. So we will do the following steps at every checkpoint:
1. suspend both primary vm and secondary vm
2. sync the state
3. resume both primary vm and secondary vm
Primary will send qemu's state in step2, and
Secondary's qemu should read it and restore the state before its/Secondary/secondary/
Quoted 2 lines
is resumed. We can not pass the state to qemu as a parameter because Secondary QEMU already started at this point, so we introduce
Quoted 7 lines
Quoted 5 lines
s/Secondary/secondary/
Quoted 2 lines
libxl__domain_restore_device_model()to do it. This API should be called before resuming secondary vm.s/before/MUST/
s/should/MUST/?
<sigh> Yes. Thank you!
PATCH v5 9/18 tools/libxl: introduce libxl__domain_common_switch_qemu_logdirty()
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
Secondary vm is running in colo mode, we need to send secondary vm's dirty page information to master at checkpoint, so we have to enable qemu logdirty on secondary.
libxl__domain_suspend_common_switch_qemu_logdirty() is to enable qemu logdirty. But it uses domain_save_state, and calls libxl__xc_domain_saverestore_async_callback_done() before exits. This can not be used for secondary vm.
Update libxl__domain_suspend_common_switch_qemu_logdirty() to introduce a new API libxl__domain_common_switch_qemu_logdirty(). This API only uses libxl__logdirty_switch, and calls lds->callback before exits.
--- tools/libxl/libxl_dom_save.c | 95 ++++++++++++++++++++++++-------------------- tools/libxl/libxl_internal.h | 8 ++++ 2 files changed, 60 insertions(+), 43 deletions(-)
tools/libxl/libxl_dom_save.c +52 -43
@@ -42,7 +42,7 @@ static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev,static void switch_logdirty_xswatch (libxl__egc *egc,libxl__ev_xswatch *,const char *watch_path,const char *event_path);static void switch_logdirty_done (libxl__egc *egc, -libxl__domain_save_state *dss,int rc); +libxl__logdirty_switch *lds,int rc);static void logdirty_init (libxl__logdirty_switch *lds) {
@@ -52,13 +52,10 @@ static void logdirty_init(libxl__logdirty_switch *lds) }static void domain_suspend_switch_qemu_xen_traditional_logdirty - (int domid,unsigned enable, -libxl__save_helper_state *shs) + (libxl__egc *egc,int domid,unsigned enable, +libxl__logdirty_switch *lds) { -libxl__egc *egc = shs->egc; -libxl__domain_save_state *dss = shs->caller_state; -libxl__logdirty_switch *lds = &dss->logdirty; -STATE_AO_GC (dss->ao); +STATE_AO_GC (lds->ao);int rc;xs_transaction_t t =0 ;const char *got;
@@ -120,26 +117,34 @@ static void domain_suspend_switch_qemu_xen_traditional_logdirty out:LOG (ERROR ,"logdirty switch failed (rc=%d), abandoning suspend" ,rc);libxl__xs_transaction_abort (gc, &t); -switch_logdirty_done (egc,dss,rc); +switch_logdirty_done (egc,lds,rc); }static void domain_suspend_switch_qemu_xen_logdirty - (int domid,unsigned enable, -libxl__save_helper_state *shs) + (libxl__egc *egc,int domid,unsigned enable, +libxl__logdirty_switch *lds) { -libxl__egc *egc = shs->egc; -libxl__domain_save_state *dss = shs->caller_state; -STATE_AO_GC (dss->ao); +STATE_AO_GC (lds->ao);int rc; rc =libxl__qmp_set_global_dirty_log (gc, domid, enable); -if (!rc) { -libxl__xc_domain_saverestore_async_callback_done (egc, shs,0 ); - }else { +if (rc)LOG (ERROR ,"logdirty switch failed (rc=%d), abandoning suspend" ,rc); + + lds->callback (egc, lds, rc); +} + +static void domain_suspend_switch_qemu_logdirty_done + (libxl__egc *egc,libxl__logdirty_switch *lds,int rc) +{ +libxl__domain_save_state *dss =CONTAINER_OF (lds, *dss, logdirty); + +if (rc) { dss->rc = rc; -libxl__xc_domain_saverestore_async_callback_done (egc, shs,-1 ); - } +libxl__xc_domain_saverestore_async_callback_done (egc, + &dss->sws.shs,-1 ); + }else +libxl__xc_domain_saverestore_async_callback_done (egc, &dss->sws.shs,0 ); }void libxl__domain_suspend_common_switch_qemu_logdirty
@@ -148,42 +153,52 @@ void libxl__domain_suspend_common_switch_qemu_logdirtylibxl__save_helper_state *shs = user;libxl__egc *egc = shs->egc;libxl__domain_save_state *dss = shs->caller_state; -STATE_AO_GC (dss->ao); + +/* convenience aliases */ +libxl__logdirty_switch *const lds = &dss->logdirty; + + lds->callback = domain_suspend_switch_qemu_logdirty_done; +libxl__domain_common_switch_qemu_logdirty (egc, domid, enable, lds); +} + +void libxl__domain_common_switch_qemu_logdirty (libxl__egc *egc, +int domid,unsigned enable, +libxl__logdirty_switch *lds) +{ +STATE_AO_GC (lds->ao);switch (libxl__device_model_version_running (gc, domid)) {case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL : -domain_suspend_switch_qemu_xen_traditional_logdirty (domid, enable, shs); +domain_suspend_switch_qemu_xen_traditional_logdirty (egc, domid, enable, + lds);break ;case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN : -domain_suspend_switch_qemu_xen_logdirty (domid, enable, shs); +domain_suspend_switch_qemu_xen_logdirty (egc, domid, enable, lds);break ;case LIBXL_DEVICE_MODEL_VERSION_NONE : -libxl__xc_domain_saverestore_async_callback_done (egc, shs,0 ); + lds->callback (egc, lds,0 );break ;default :LOG (ERROR ,"logdirty switch failed" ", no valid device model version found, abandoning suspend" ); - dss->rc =ERROR_FAIL ; -libxl__xc_domain_saverestore_async_callback_done (egc, shs,-1 ); + lds->callback (egc, lds,ERROR_FAIL ); } }static void switch_logdirty_timeout (libxl__egc *egc,libxl__ev_time *ev,const struct timeval *requested_abs,int rc) { -libxl__domain_save_state *dss =CONTAINER_OF (ev, *dss, logdirty.timeout); -STATE_AO_GC (dss->ao); +libxl__logdirty_switch *lds =CONTAINER_OF (ev, *lds, timeout); +STATE_AO_GC (lds->ao);LOG (ERROR ,"logdirty switch: wait for device model timed out" ); -switch_logdirty_done (egc,dss,ERROR_FAIL ); +switch_logdirty_done (egc,lds,ERROR_FAIL ); }static void switch_logdirty_xswatch (libxl__egc *egc,libxl__ev_xswatch *watch,const char *watch_path,const char *event_path) { -libxl__domain_save_state *dss = -CONTAINER_OF (watch, *dss, logdirty.watch); -libxl__logdirty_switch *lds = &dss->logdirty; -STATE_AO_GC (dss->ao); +libxl__logdirty_switch *lds =CONTAINER_OF (watch, *lds, watch); +STATE_AO_GC (lds->ao);const char *got;xs_transaction_t t =0 ;int rc;
@@ -229,28 +244,20 @@ static void switch_logdirty_xswatch(libxl__egc *egc, libxl__ev_xswatch *watch,if (rc <=0 ) {if (rc <0 )LOG (ERROR ,"logdirty switch: failed (rc=%d)" ,rc); -switch_logdirty_done (egc,dss,rc); +switch_logdirty_done (egc,lds,rc); } }static void switch_logdirty_done (libxl__egc *egc, -libxl__domain_save_state *dss, +libxl__logdirty_switch *lds,int rc) { -STATE_AO_GC (dss->ao); -libxl__logdirty_switch *lds = &dss->logdirty; +STATE_AO_GC (lds->ao);libxl__ev_xswatch_deregister (gc, &lds->watch);libxl__ev_time_deregister (gc, &lds->timeout); -int broke; -if (rc) { - broke =-1 ; - dss->rc = rc; - }else { - broke =0 ; - } -libxl__xc_domain_saverestore_async_callback_done (egc, &dss->sws.shs, broke); + lds->callback (egc, lds, rc); }/*----- callbacks, called by xc_domain_save -----*/
@@ -346,6 +353,8 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) dss->rc =0 ;logdirty_init (&dss->logdirty); + dss->logdirty.ao = ao; + dsps->ao = ao; dsps->domid = domid; rc =libxl__domain_suspend_init (egc, dsps);
tools/libxl/libxl_internal.h +8 -0
@@ -3071,6 +3071,11 @@ libxl__stream_write_inuse(const libxl__stream_write_state *stream) } typedef struct libxl__logdirty_switch { + /* set by caller of libxl__domain_common_switch_qemu_logdirty */ + libxl__ao *ao; + void (*callback)(libxl__egc *egc, struct libxl__logdirty_switch *lds, + int rc); + const char *cmd; const char *cmd_path; const char *ret_path;
@@ -3490,6 +3495,9 @@ void libxl__xc_domain_saverestore_async_callback_done(libxl__egc *egc, _hidden void libxl__domain_suspend_common_switch_qemu_logdirty (int domid,unsigned int enable,void *data); +_hidden void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc, +int domid,unsigned enable, +libxl__logdirty_switch *lds); _hidden int libxl__save_emulator_xenstore_data(libxl__domain_save_state *dss,char **buf,uint32_t *len); _hidden int libxl__restore_emulator_xenstore_data
Signature · 1 line
2.5.0
PATCH v5 10/18 tools/libxl: export logdirty_init
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
We need to enable logdirty on secondary, so we export logdirty_init for internal use. Rename it to libxl__logdirty_init.
--- tools/libxl/libxl_dom_save.c | 4 ++-- tools/libxl/libxl_internal.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
tools/libxl/libxl_dom_save.c +2 -2
@@ -44,7 +44,7 @@ static void switch_logdirty_xswatch(libxl__egc *egc, libxl__ev_xswatch*,static void switch_logdirty_done (libxl__egc *egc,libxl__logdirty_switch *lds,int rc); -static void logdirty_init (libxl__logdirty_switch *lds) +void libxl__logdirty_init (libxl__logdirty_switch *lds) { lds->cmd_path =0 ;libxl__ev_xswatch_init (&lds->watch);
@@ -352,7 +352,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) } dss->rc =0 ; -logdirty_init (&dss->logdirty); +libxl__logdirty_init (&dss->logdirty); dss->logdirty.ao = ao; dsps->ao = ao;
tools/libxl/libxl_internal.h +2 -0
@@ -3083,6 +3083,8 @@ typedef struct libxl__logdirty_switch {libxl__ev_time timeout; } libxl__logdirty_switch; +_hidden void libxl__logdirty_init(libxl__logdirty_switch *lds); +struct libxl__domain_suspend_state {/* set by caller of libxl__domain_suspend_init */ libxl__ao *ao;
Signature · 1 line
2.5.0
PATCH v5 11/18 tools/libxl: Add back channel to allow migration target send data back
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
In colo mode, slave needs to send data to master, but the io_fd only can be written in master, and only can be read in slave. Save recv_fd in domain_suspend_state, and send_fd in domain_create_state.
Extend libxl_domain_create_restore API, add a send_fd param to it.
Add LIBXL_HAVE_CREATE_RESTORE_SEND_FD to indicate the API change.
--- tools/libxl/libxl.c | 2 +- tools/libxl/libxl.h | 30 ++++++++++++++++++++++++++++-- tools/libxl/libxl_create.c | 9 +++++---- tools/libxl/libxl_internal.h | 2 ++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 8 +++++++- tools/ocaml/libs/xl/xenlight_stubs.c | 2 +- 7 files changed, 45 insertions(+), 9 deletions(-)
tools/libxl/libxl.c +1 -1
@@ -872,7 +872,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, dss->callback = remus_failover_cb; dss->domid = domid; dss->fd = send_fd; -/* TODO do something with recv_fd */ + dss->recv_fd = recv_fd; dss->type = type; dss->live =1 ; dss->debug =0 ;
tools/libxl/libxl.h +28 -2
@@ -630,6 +630,15 @@ typedef struct libxl__ctx libxl_ctx;#define LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS 1/* +* LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_FD 1 +* +* If this is defined, libxl_domain_create_restore()'s API has changed to +* include a send_fd param which used for libxl migration back channel +* during COLO FT. +*/ +#define LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_FD 1 + +/* * LIBXL_HAVE_CREATEINFO_PVH * If this is defined, then libxl supports creation of a PVH guest. */
@@ -1143,7 +1152,7 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, const libxl_asyncprogress_how *aop_console_how)LIBXL_EXTERNAL_CALLERS_ONLY ;int libxl_domain_create_restore (libxl_ctx *ctx,libxl_domain_config *d_config, -uint32_t *domid,int restore_fd, +uint32_t *domid,int restore_fd,int send_fd,const libxl_domain_restore_params *params,const libxl_asyncop_how *ao_how,const libxl_asyncprogress_how *aop_console_how)
@@ -1164,7 +1173,7 @@ int static inline libxl_domain_create_restore_0x040200(libxl_domain_restore_params_init (¶ms); ret =libxl_domain_create_restore ( - ctx, d_config, domid, restore_fd, ¶ms, ao_how, aop_console_how); + ctx, d_config, domid, restore_fd,-1 , ¶ms, ao_how, aop_console_how);libxl_domain_restore_params_dispose (¶ms);return ret;
@@ -1172,6 +1181,23 @@ int static inline libxl_domain_create_restore_0x040200(#define libxl_domain_create_restore libxl_domain_create_restore_0x040200 +#elif defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION >=0x040400 \ + &&LIBXL_API_VERSION <0x040600 + +int static inline libxl_domain_create_restore_0x040400 ( +libxl_ctx *ctx,libxl_domain_config *d_config, +uint32_t *domid,int restore_fd, +const libxl_domain_restore_params *params, +const libxl_asyncop_how *ao_how, +const libxl_asyncprogress_how *aop_console_how) +LIBXL_EXTERNAL_CALLERS_ONLY +{ +return libxl_domain_create_restore (ctx, d_config, domid, restore_fd, +-1 , params, ao_how, aop_console_how); +} + +#define libxl_domain_create_restore libxl_domain_create_restore_0x040400 +#endif int libxl_domain_soft_reset(libxl_ctx *ctx,
tools/libxl/libxl_create.c +5 -4
@@ -1548,7 +1548,7 @@ static void domain_create_cb(libxl__egc *egc, int rc, uint32_t domid);static int do_domain_create (libxl_ctx *ctx,libxl_domain_config *d_config, -uint32_t *domid,int restore_fd, +uint32_t *domid,int restore_fd,int send_fd,const libxl_domain_restore_params *params,const libxl_asyncop_how *ao_how,const libxl_asyncprogress_how *aop_console_how)
@@ -1563,6 +1563,7 @@ static int do_domain_create(libxl_ctx *ctx, libxl_domain_config *d_config,libxl_domain_config_init (&cdcs->dcs.guest_config_saved);libxl_domain_config_copy (ctx, &cdcs->dcs.guest_config_saved, d_config); cdcs->dcs.restore_fd = cdcs->dcs.libxc_fd = restore_fd; + cdcs->dcs.send_fd = send_fd;if (restore_fd >-1 ) { cdcs->dcs.restore_params = *params; rc = libxl__fd_flags_modify_save(gc, cdcs->dcs.restore_fd,
@@ -1741,17 +1742,17 @@ int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config,const libxl_asyncop_how *ao_how, const libxl_asyncprogress_how *aop_console_how) { - return do_domain_create(ctx, d_config, domid, -1, NULL, + return do_domain_create(ctx, d_config, domid, -1, -1, NULL,ao_how ,aop_console_how ); }int libxl_domain_create_restore (libxl_ctx *ctx,libxl_domain_config *d_config, -uint32_t *domid,int restore_fd, +uint32_t *domid,int restore_fd,int send_fd,const libxl_domain_restore_params *params,const libxl_asyncop_how *ao_how,const libxl_asyncprogress_how *aop_console_how) { -return do_domain_create (ctx, d_config, domid, restore_fd, params, +return do_domain_create (ctx, d_config, domid, restore_fd, send_fd, params, ao_how, aop_console_how); }
tools/libxl/libxl_internal.h +2 -0
@@ -3116,6 +3116,7 @@ struct libxl__domain_save_state {uint32_t domid;int fd;int fdfl;/* original flags on fd */ +int recv_fd;libxl_domain_type type;int live;int debug;
@@ -3453,6 +3454,7 @@ struct libxl__domain_create_state {libxl_domain_config guest_config_saved;/* vanilla config */ int restore_fd, libxc_fd;int restore_fdfl;/* original flags of restore_fd */ +int send_fd;libxl_domain_restore_params restore_params;uint32_t domid_soft_reset;libxl__domain_create_cb *callback;
tools/libxl/libxl_types.idl +1 -0
@@ -232,6 +232,7 @@ libxl_hdtype = Enumeration("hdtype", [ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (0, "NONE"), (1, "REMUS"), + (2, "COLO"), ]) #
tools/libxl/xl_cmdimpl.c +7 -1
@@ -159,6 +159,7 @@ struct domain_create {char *extra_config;/* extra config string */ const char *restore_file;int migrate_fd;/* -1 means none */ +int send_fd;/* -1 means none */ char **migration_domname_r;/* from malloc */ };
@@ -2686,6 +2687,7 @@ static uint32_t create_domain(struct domain_create *dom_info)int config_len =0 ;int restore_fd =-1 ;int restore_fd_to_close =-1 ; +int send_fd =-1 ;const libxl_asyncprogress_how *autoconnect_console_how;struct save_file_header hdr;uint32_t domid_soft_reset =INVALID_DOMID ;
@@ -2703,6 +2705,7 @@ static uint32_t create_domain(struct domain_create *dom_info)if (migrate_fd >=0 ) { restore_source ="<incoming migration stream>" ; restore_fd = migrate_fd; + send_fd = dom_info->send_fd; }else { restore_source = restore_file; restore_fd =open (restore_file,O_RDONLY );
@@ -2893,7 +2896,7 @@ start: ret =libxl_domain_create_restore (ctx, &d_config, &domid, restore_fd, - ¶ms, + send_fd, ¶ms,0 , autoconnect_console_how);libxl_domain_restore_params_dispose (¶ms);
@@ -4449,6 +4452,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, dom_info.monitor = monitor; dom_info.paused =1 ; dom_info.migrate_fd = recv_fd; + dom_info.send_fd = send_fd; dom_info.migration_domname_r = &migration_domname; dom_info.checkpointed_stream = checkpointed;
@@ -4622,6 +4626,7 @@ int main_restore(int argc, char **argv) dom_info.config_file = config_file; dom_info.restore_file = checkpoint_file; dom_info.migrate_fd =-1 ; + dom_info.send_fd =-1 ; dom_info.vnc = vnc; dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect;
@@ -5088,6 +5093,7 @@ int main_create(int argc, char **argv) dom_info.quiet = quiet; dom_info.config_file = filename; dom_info.migrate_fd =-1 ; + dom_info.send_fd =-1 ; dom_info.vnc = vnc; dom_info.vncautopass = vncautopass; dom_info.console_autoconnect = console_autoconnect;
tools/ocaml/libs/xl/xenlight_stubs.c +1 -1
@@ -537,7 +537,7 @@ value stub_libxl_domain_create_restore(value ctx, value domain_config, value par restore_fd =Int_val (Field (params,0 ));caml_enter_blocking_section (); - ret =libxl_domain_create_restore (CTX , &c_dconfig, &c_domid, restore_fd, + ret =libxl_domain_create_restore (CTX , &c_dconfig, &c_domid, restore_fd,-1 , &c_params, ao_how,NULL );caml_leave_blocking_section ();
Signature · 1 line
2.5.0
PATCH v5 12/18 tools/libx{l, c}: add back channel to libxc
In reply to Wen CongyangIn COLO mode, both VMs are running, and are considered in sync if the visible network traffic is identical. After some time, they fall out of sync.
At this point, the two VMs have definitely diverged. Lets call the primary dirty bitmap set A, while the secondary dirty bitmap set B.
Sets A and B are different.
Under normal migration, the page data for set A will be sent form the primary to the secondary.
However, the set difference B - A (lets call this C) is out-of-date on the secondary (with respect to the primary) and will not be sent by the primary, as it was not memory dirtied by the primary. The secondary needs the page data for C to reconstruct an exact copy of the primary at the checkpoint.
The secondary cannot calculate C as it doesn't know A. Instead, the secondary must send B to the primary, at which point the primary calculates the union of A and B (lets call this D) which is all the pages dirtied by both the primary and the secondary, and sends all page data covered by D.
In the general case, D is a superset of both A and B. Without the backchannel dirty bitmap, a COLO checkpoint can't reconstruct a valid copy of the primary.
We transfer the dirty bitmap on libxc side, so we need to introduce back channel to libxc.
Note: it is different from the paper. We change the original design to the current one, according to our following concerns:
1. The original design needs extra memory on Secondary host. When there's multiple backups on one host, the memory cost is high.
2. The memory cache code will be another 1k+, it will make the review more time consuming.
commit message:
--- tools/libxc/include/xenguest.h | 4 ++-- tools/libxc/xc_nomigrate.c | 4 ++-- tools/libxc/xc_sr_restore.c | 2 +- tools/libxc/xc_sr_save.c | 2 +- tools/libxl/libxl_save_callout.c | 39 ++++++++++++++++++++++++++------------- tools/libxl/libxl_save_helper.c | 8 ++++++-- 6 files changed, 38 insertions(+), 21 deletions(-)
tools/libxc/include/xenguest.h +2 -2
@@ -82,7 +82,7 @@ struct save_callbacks {int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags/* XCFLAGS_xxx */ ,struct save_callbacks * callbacks,int hvm, -int checkpointed_stream); +int checkpointed_stream,int back_fd);/* callbacks provided by xc_domain_restore */ struct restore_callbacks {
@@ -121,7 +121,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_mfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, int checkpointed_stream, - struct restore_callbacks *callbacks); + struct restore_callbacks *callbacks, int back_fd);/** * This function will create a domain for a paravirtualized Linux
tools/libxc/xc_nomigrate.c +2 -2
@@ -23,7 +23,7 @@int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags,struct save_callbacks * callbacks,int hvm, -int checkpointed_stream) +int checkpointed_stream,int back_fd) { errno =ENOSYS ;return -1 ;
@@ -35,7 +35,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_mfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, int checkpointed_stream, - struct restore_callbacks *callbacks) + struct restore_callbacks *callbacks, int back_fd) { errno =ENOSYS ;return -1 ;
tools/libxc/xc_sr_restore.c +1 -1
@@ -722,7 +722,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_gfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, int checkpointed_stream, - struct restore_callbacks *callbacks) + struct restore_callbacks *callbacks, int back_fd) { struct xc_sr_context ctx = {
tools/libxc/xc_sr_save.c +1 -1
@@ -824,7 +824,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)int xc_domain_save (xc_interface *xch,int io_fd,uint32_t dom,uint32_t max_iters,uint32_t max_factor,uint32_t flags,struct save_callbacks * callbacks,int hvm, -int checkpointed_stream) +int checkpointed_stream,int back_fd) {struct xc_sr_context ctx = {
tools/libxl/libxl_save_callout.c +26 -13
@@ -27,7 +27,7 @@*/ static void run_helper (libxl__egc *egc,libxl__save_helper_state *shs,const char *mode_arg, -int stream_fd, +int stream_fd,int back_fd,const int *preserve_fds,int num_preserve_fds,const unsigned long *argnums,int num_argnums);
@@ -50,6 +50,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs,/* Convenience aliases */ const uint32_t domid = dcs->guest_domid;const int restore_fd = dcs->libxc_fd; +const int send_fd = dcs->send_fd;libxl__domain_build_state *const state = &dcs->build_state; unsigned cbflags =
@@ -71,7 +72,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, shs->caller_state = dcs; shs->need_results =1 ; -run_helper (egc, shs,"--restore-domain" , restore_fd,0 ,0 , +run_helper (egc, shs,"--restore-domain" , restore_fd, send_fd,0 ,0 , argnums,ARRAY_SIZE (argnums)); }
@@ -95,7 +96,7 @@ void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_save_state *dss, shs->caller_state = dss; shs->need_results =0 ; -run_helper (egc, shs,"--save-domain" , dss->fd, +run_helper (egc, shs,"--save-domain" , dss->fd, dss->recv_fd,NULL ,0 , argnums,ARRAY_SIZE (argnums));return ;
@@ -118,14 +119,29 @@ void libxl__save_helper_init(libxl__save_helper_state *shs) }/*----- helper execution -----*/ +static int dup_fd_helper (libxl__gc *gc,int fd,const char *what) +{ +int dup_fd = fd; + +if (fd <=2 ) { + dup_fd =dup (fd); +if (dup_fd <0 ) { +LOGE (ERROR ,"dup %s" , what); +exit (-1 ); + } + } +libxl_fd_set_cloexec (CTX , dup_fd,0 ); + +return dup_fd; +}static void run_helper (libxl__egc *egc,libxl__save_helper_state *shs, -const char *mode_arg,int stream_fd, +const char *mode_arg,int stream_fd,int back_fd,const int *preserve_fds,int num_preserve_fds,const unsigned long *argnums,int num_argnums) {STATE_AO_GC (shs->ao); -const char *args[4 + num_argnums]; +const char *args[5 + num_argnums];const char **arg = args;int i, rc;
@@ -153,6 +169,7 @@ static void run_helper(libxl__egc *egc, libxl__save_helper_state *shs, *arg++ =getenv ("LIBXL_SAVE_HELPER" ) ?:LIBEXEC_BIN "/" "libxl-save-helper" ; *arg++ = mode_arg;const char **stream_fd_arg = arg++; +const char **back_fd_arg = arg++;for (i=0 ; i<num_argnums; i++) *arg++ =GCSPRINTF ("%lu" , argnums[i]); *arg++ =0 ;
@@ -177,16 +194,12 @@ static void run_helper(libxl__egc *egc, libxl__save_helper_state *shs,pid_t pid =libxl__ev_child_fork (gc, &shs->child, helper_exited);if (!pid) { -if (stream_fd <=2 ) { - stream_fd =dup (stream_fd); -if (stream_fd <0 ) { -LOGE (ERROR ,"dup migration stream fd" ); -exit (-1 ); - } - } -libxl_fd_set_cloexec (CTX , stream_fd,0 ); + stream_fd =dup_fd_helper (gc, stream_fd,"migration stream fd" ); *stream_fd_arg =GCSPRINTF ("%d" , stream_fd); + back_fd =dup_fd_helper (gc, back_fd,"migration back channel fd" ); + *back_fd_arg =GCSPRINTF ("%d" , back_fd); +for (i=0 ; i<num_preserve_fds; i++)if (preserve_fds[i] >=0 ) {assert (preserve_fds[i] >2 );
tools/libxl/libxl_save_helper.c +6 -2
@@ -238,6 +238,7 @@ static struct restore_callbacks helper_restore_callbacks;int main (int argc,char **argv) {int r; +int back_fd;#define NEXTARG (++argv, assert(*argv), *argv)
@@ -247,6 +248,7 @@ int main(int argc, char **argv)if (!strcmp (mode,"--save-domain" )) { io_fd =atoi (NEXTARG ); + back_fd =atoi (NEXTARG );uint32_t dom =strtoul (NEXTARG ,0 ,10 );uint32_t max_iters =strtoul (NEXTARG ,0 ,10 );uint32_t max_factor =strtoul (NEXTARG ,0 ,10 );
@@ -262,12 +264,14 @@ int main(int argc, char **argv)setup_signals (save_signal_handler); r =xc_domain_save (xch, io_fd, dom, max_iters, max_factor, flags, - &helper_save_callbacks, hvm, checkpointed_stream); + &helper_save_callbacks, hvm, checkpointed_stream, + back_fd);complete (r); }else if (!strcmp (mode,"--restore-domain" )) { io_fd =atoi (NEXTARG ); + back_fd =atoi (NEXTARG );uint32_t dom =strtoul (NEXTARG ,0 ,10 );unsigned store_evtchn =strtoul (NEXTARG ,0 ,10 );domid_t store_domid =strtoul (NEXTARG ,0 ,10 );
@@ -292,7 +296,7 @@ int main(int argc, char **argv) store_domid, console_evtchn, &console_mfn, console_domid, hvm, pae, superpages, checkpointed, - &helper_restore_callbacks); + &helper_restore_callbacks, back_fd);helper_stub_restore_results (store_mfn,console_mfn,0 );complete (r);
Signature · 1 line
2.5.0
PATCH v5 13/18 tools/libxl: rename remus device to checkpoint device
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
This patch is auto generated by the following commands:
1. git mv tools/libxl/libxl_remus_device.c tools/libxl/libxl_checkpoint_device.c
2. perl -pi -e 's/libxl_remus_device/libxl_checkpoint_device/g' tools/libxl/Makefile
3. perl -pi -e 's/\blibxl__remus_devices/libxl__checkpoint_devices/g' tools/libxl/*.[ch]
4. perl -pi -e 's/\blibxl__remus_device\b/libxl__checkpoint_device/g' tools/libxl/*.[ch]
5. perl -pi -e 's/\blibxl__remus_device_instance_ops\b/libxl__checkpoint_device_instance_ops/g' tools/libxl/*.[ch]
6. perl -pi -e 's/\blibxl__remus_callback\b/libxl__checkpoint_callback/g' tools/libxl/*.[ch]
7. perl -pi -e 's/\bremus_device_init\b/checkpoint_device_init/g' tools/libxl/*.[ch]
8. perl -pi -e 's/\bremus_devices_setup\b/checkpoint_devices_setup/g' tools/libxl/*.[ch]
9. perl -pi -e 's/\bdefine_remus_checkpoint_api\b/define_checkpoint_api/g' tools/libxl/*.[ch]
10. perl -pi -e 's/\brds\b/cds/g' tools/libxl/*.[ch]
11. perl -pi -e 's/REMUS_DEVICE/CHECKPOINT_DEVICE/g' tools/libxl/*.[ch] tools/libxl/*.idl
12. perl -pi -e 's/REMUS_DEVOPS/CHECKPOINT_DEVOPS/g' tools/libxl/*.[ch] tools/libxl/*.idl
13. perl -pi -e 's/\bremus\b/checkpoint/g' tools/libxl/libxl_checkpoint_device.[ch]
14. perl -pi -e 's/\bremus device/checkpoint device/g' tools/libxl/libxl_internal.h
15. perl -pi -e 's/\bRemus device/checkpoint device/g' tools/libxl/libxl_internal.h
16. perl -pi -e 's/\bremus abstract/checkpoint abstract/g' tools/libxl/libxl_internal.h
17. perl -pi -e 's/\bremus invocation/checkpoint invocation/g' tools/libxl/libxl_internal.h
18. perl -pi -e 's/\blibxl__remus_device_\(/libxl__checkpoint_device_(/g' tools/libxl/libxl_internal.h
---
tools/libxl/Makefile | 2 +-
...xl_remus_device.c => libxl_checkpoint_device.c} | 198 ++++++++++-----------
tools/libxl/libxl_internal.h | 112 ++++++------
tools/libxl/libxl_netbuffer.c | 108 +++++------
tools/libxl/libxl_nonetbuffer.c | 10 +-
tools/libxl/libxl_remus.c | 76 ++++----
tools/libxl/libxl_remus_disk_drbd.c | 52 +++---
tools/libxl/libxl_types.idl | 4 +-
8 files changed, 281 insertions(+), 281 deletions(-)
rename tools/libxl/{libxl_remus_device.c => libxl_checkpoint_device.c} (52%)tools/libxl/Makefile +1 -1
@@ -62,7 +62,7 @@ else LIBXL_OBJS-y += libxl_no_convert_callout.o endif -LIBXL_OBJS-y += libxl_remus.o libxl_remus_device.o libxl_remus_disk_drbd.o +LIBXL_OBJS-y += libxl_remus.o libxl_checkpoint_device.o libxl_remus_disk_drbd.o LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
tools/libxl/libxl_checkpoint_device.c renamed from tools/libxl/libxl_remus_device.c +99 -99
359 lines not on this page · raw message
tools/libxl/libxl_internal.h +56 -56
214 lines not on this page · raw message
tools/libxl/libxl_netbuffer.c +54 -54
300 lines not on this page · raw message
tools/libxl/libxl_nonetbuffer.c +5 -5
@@ -22,25 +22,25 @@ int libxl__netbuffer_enabled(libxl__gc *gc)return 0 ; } -int init_subkind_nic (libxl__remus_devices_state *rds) +int init_subkind_nic (libxl__checkpoint_devices_state *cds) {return 0 ; } -void cleanup_subkind_nic (libxl__remus_devices_state *rds) +void cleanup_subkind_nic (libxl__checkpoint_devices_state *cds) {return ; } -static void nic_setup (libxl__egc *egc,libxl__remus_device *dev) +static void nic_setup (libxl__egc *egc,libxl__checkpoint_device *dev) { -STATE_AO_GC (dev->rds->ao); +STATE_AO_GC (dev->cds->ao); dev->aodev.rc =ERROR_FAIL ; dev->aodev.callback (egc, &dev->aodev); } -const libxl__remus_device_instance_ops remus_device_nic = { +const libxl__checkpoint_device_instance_ops remus_device_nic = { .kind =LIBXL__DEVICE_KIND_VIF , .setup = nic_setup, };
tools/libxl/libxl_remus.c +38 -38
195 lines not on this page · raw message
tools/libxl/libxl_remus_disk_drbd.c +26 -26
152 lines not on this page · raw message
tools/libxl/libxl_types.idl +2 -2
@@ -61,8 +61,8 @@ libxl_error = Enumeration("error", [ (-15, "LOCK_FAIL"), (-16, "JSON_CONFIG_EMPTY"), (-17, "DEVICE_EXISTS"), - (-18, "REMUS_DEVOPS_DOES_NOT_MATCH"), - (-19, "REMUS_DEVICE_NOT_SUPPORTED"), + (-18, "CHECKPOINT_DEVOPS_DOES_NOT_MATCH"), + (-19, "CHECKPOINT_DEVICE_NOT_SUPPORTED"), (-20, "VNUMA_CONFIG_INVALID"), (-21, "DOMAIN_NOTFOUND"), (-22, "ABORTED"),
Signature · 1 line
2.5.0
PATCH v5 14/18 tools/libxl: fix backword compatibility after the automatic renaming
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
The error code ERROR_REMUS_XXX was introduced in Xen 4.5, and changed to ERROR_CHECKPOINT_XXX after previous renaming. The patch fix the backword compatibility.
--- tools/libxl/libxl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
tools/libxl/libxl.h +13 -0
@@ -883,6 +883,19 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);*/ #define LIBXL_HAVE_CHECKPOINTED_STREAM 1 +/* Remus stuff */ +/* +* ERROR_REMUS_XXX error code only exists from Xen 4.5, and in Xen 4.6 +* it is changed to ERROR_CHECKPOINT_XXX +*/ +#if defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION >=0x040500 \ + &&LIBXL_API_VERSION <0x040600 +#define ERROR_REMUS_DEVOPS_DOES_NOT_MATCH \ + ERROR_CHECKPOINT_DEVOPS_DOES_NOT_MATCH +#define ERROR_REMUS_DEVICE_NOT_SUPPORTED \ + ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED +#endif +typedef char **libxl_string_list ;void libxl_string_list_dispose (libxl_string_list *sl);int libxl_string_list_length (const libxl_string_list *sl);
Signature · 1 line
2.5.0
Re: [PATCH v5 COLOPre 14/18] tools/libxl: fix backword compatibility after the automatic renaming
Quoted 17 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
The error code
ERROR_REMUS_XXXwas introduced in Xen 4.5, and changed toERROR_CHECKPOINT_XXXafter previous renaming. The patch fix the backword compatibility.Signed-off-by Yang Hongyang <[email protected]>Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)tools/libxl/libxl.h +0
-0
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 886
Quoted 4 lines
tools/libxl/libxl.h +1
-0@@ -883,6 +883,19 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);*/ #define LIBXL_HAVE_CHECKPOINTED_STREAM 1 +/* Remus stuff */
/sRemus stuff//
.. as it is obvious that this is remus related.
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 888
Quoted 2 lines
tools/libxl/libxl.h +2
-0+/* +* ERROR_REMUS_XXX error code only exists from Xen 4.5, and in Xen 4.6
s/4.6/4.7/
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 892
Quoted 4 lines
tools/libxl/libxl.h +4
-0+* it is changed to ERROR_CHECKPOINT_XXX +*/ +#if defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION >=0x040500 \ + &&LIBXL_API_VERSION <0x040600
s/040600/040700/
Quoted 19 lines
tools/libxl/libxl.h +6
-0+#define ERROR_REMUS_DEVOPS_DOES_NOT_MATCH \ + ERROR_CHECKPOINT_DEVOPS_DOES_NOT_MATCH +#define ERROR_REMUS_DEVICE_NOT_SUPPORTED \ + ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED +#endif +typedef char **libxl_string_list ;void libxl_string_list_dispose (libxl_string_list *sl);int libxl_string_list_length (const libxl_string_list *sl);Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 COLOPre 14/18] tools/libxl: fix backword compatibility after the automatic renaming
Quoted 21 lines · Konrad Rzeszutek Wilk
Quoted 20 lines · Wen Congyang
From: Yang Hongyang <[email protected]>
The error code
ERROR_REMUS_XXXwas introduced in Xen 4.5, and changed toERROR_CHECKPOINT_XXXafter previous renaming. The patch fix the backword compatibility.Signed-off-by Yang Hongyang <[email protected]>Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)tools/libxl/libxl.h +0
-0@@ -883,6 +883,19 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);*/ #define LIBXL_HAVE_CHECKPOINTED_STREAM 1
Quoted 3 lines
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 886
Quoted 1 line
tools/libxl/libxl.h +1
-0+/* Remus stuff */ /sRemus stuff//
Do you mean remove this line?
Quoted 6 lines
.. as it is obvious that this is remus related.
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 888
Quoted 2 lines
tools/libxl/libxl.h +2
-0+/* +* ERROR_REMUS_XXX error code only exists from Xen 4.5, and in Xen 4.6 s/4.6/4.7/
Will fix it in the next version.
Quoted 7 lines
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 892
Quoted 5 lines
tools/libxl/libxl.h +4
-0+* it is changed to ERROR_CHECKPOINT_XXX +*/ +#if defined(LIBXL_API_VERSION ) &&LIBXL_API_VERSION >=0x040500 \ + &&LIBXL_API_VERSION <0x040600 s/040600/040700/
Will fix it in the next version.
Thanks
Wen Congyang
Quoted 24 lines
Quoted 20 lines
tools/libxl/libxl.h +6
-0+#define ERROR_REMUS_DEVOPS_DOES_NOT_MATCH \ + ERROR_CHECKPOINT_DEVOPS_DOES_NOT_MATCH +#define ERROR_REMUS_DEVICE_NOT_SUPPORTED \ + ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED +#endif +typedef char **libxl_string_list ;void libxl_string_list_dispose (libxl_string_list *sl);int libxl_string_list_length (const libxl_string_list *sl);Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel.
Re: [PATCH v5 COLOPre 14/18] tools/libxl: fix backword compatibility after the automatic renaming
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+/* Remus stuff */
/sRemus stuff//
Do you mean remove this line?
<nods>
PATCH v5 15/18 tools/libxl: adjust the indentation
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
This is just tidying up after the previous automatic renaming.
--- tools/libxl/libxl_checkpoint_device.c | 21 +++++++++++---------- tools/libxl/libxl_internal.h | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-)
tools/libxl/libxl_checkpoint_device.c +11 -10
@@ -73,9 +73,9 @@ static void devices_teardown_cb(libxl__egc *egc,/* checkpoint device setup and teardown */ static libxl__checkpoint_device *checkpoint_device_init (libxl__egc *egc, -libxl__checkpoint_devices_state *cds, -libxl__device_kind kind, -void *libxl_dev) +libxl__checkpoint_devices_state *cds, +libxl__device_kind kind, +void *libxl_dev) {libxl__checkpoint_device *dev =NULL ;
@@ -89,9 +89,10 @@ static libxl__checkpoint_device* checkpoint_device_init(libxl__egc *egc, }static void checkpoint_devices_setup (libxl__egc *egc, -libxl__checkpoint_devices_state *cds); +libxl__checkpoint_devices_state *cds); -void libxl__checkpoint_devices_setup (libxl__egc *egc,libxl__checkpoint_devices_state *cds) +void libxl__checkpoint_devices_setup (libxl__egc *egc, +libxl__checkpoint_devices_state *cds) {int i, rc;
@@ -137,7 +138,7 @@ out: }static void checkpoint_devices_setup (libxl__egc *egc, -libxl__checkpoint_devices_state *cds) +libxl__checkpoint_devices_state *cds) {int i, rc;
@@ -285,12 +286,12 @@ static void devices_checkpoint_cb(libxl__egc *egc,/* API implementations */ -#define define_checkpoint_api (api) \ -void libxl__checkpoint_devices_##api(libxl__egc *egc, \ - libxl__checkpoint_devices_state *cds) \ +#define define_checkpoint_api (api) \ +void libxl__checkpoint_devices_##api(libxl__egc *egc, \ + libxl__checkpoint_devices_state *cds) \ { \ int i; \ - libxl__checkpoint_device *dev; \ + libxl__checkpoint_device *dev; \ \ STATE_AO_GC(cds->ao); \ \
tools/libxl/libxl_internal.h +11 -8
@@ -2818,7 +2818,8 @@ typedef struct libxl__save_helper_state {* Each device type needs to implement the interfaces specified in * the libxl__checkpoint_device_instance_ops if it wishes to support Remus. * -* The high-level control flow through the checkpoint device layer is shown below: +* The high-level control flow through the checkpoint device layer is shown +* below: * * xl remus * |-> libxl_domain_remus_start
@@ -2879,7 +2880,8 @@ int init_subkind_drbd_disk(libxl__checkpoint_devices_state *cds);void cleanup_subkind_drbd_disk (libxl__checkpoint_devices_state *cds);typedef void libxl__checkpoint_callback (libxl__egc *, -libxl__checkpoint_devices_state *,int rc); +libxl__checkpoint_devices_state *, +int rc);/* * State associated with a checkpoint invocation, including parameters
@@ -2887,7 +2889,7 @@ typedef void libxl__checkpoint_callback(libxl__egc *,* save/restore machinery. */ struct libxl__checkpoint_devices_state { -/*---- must be set by caller of libxl__checkpoint_device_(setup|teardown) ----*/ +/*-- must be set by caller of libxl__checkpoint_device_(setup|teardown) --*/ libxl__ao *ao;uint32_t domid;
@@ -2900,7 +2902,8 @@ struct libxl__checkpoint_devices_state {/* * this array is allocated before setup the checkpoint devices by the * checkpoint abstract layer. -* devs may be NULL, means there's no checkpoint devices that has been set up. +* devs may be NULL, means there's no checkpoint devices that has been +* set up. * the size of this array is 'num_devices', which is the total number * of libxl nic devices and disk devices(num_nics + num_disks). */
@@ -2962,13 +2965,13 @@ struct libxl__checkpoint_device { _hidden void libxl__checkpoint_devices_setup(libxl__egc *egc,libxl__checkpoint_devices_state *cds); _hidden void libxl__checkpoint_devices_teardown(libxl__egc *egc, -libxl__checkpoint_devices_state *cds); +libxl__checkpoint_devices_state *cds); _hidden void libxl__checkpoint_devices_postsuspend(libxl__egc *egc, -libxl__checkpoint_devices_state *cds); +libxl__checkpoint_devices_state *cds); _hidden void libxl__checkpoint_devices_preresume(libxl__egc *egc, -libxl__checkpoint_devices_state *cds); +libxl__checkpoint_devices_state *cds); _hidden void libxl__checkpoint_devices_commit(libxl__egc *egc, -libxl__checkpoint_devices_state *cds); +libxl__checkpoint_devices_state *cds); _hidden int libxl__netbuffer_enabled(libxl__gc *gc);/*----- Legacy conversion helper -----*/
Signature · 1 line
2.5.0
PATCH v5 16/18 tools/libxl: store remus_ops in checkpoint device state
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
Checkpoint device is an abstract layer to do checkpoint. COLO can also use it to do checkpoint. But there are still some codes in checkpoint device which touch remus.
This patch and the following 2 will seperate remus from checkpoint device layer.
We use remus ops directly in checkpoint device. Store it in checkpoint device state so that we do not aware of remus_ops in the checkpoint device layer.
it is pure refactoring and no functional changes.
--- tools/libxl/libxl_checkpoint_device.c | 10 +--------- tools/libxl/libxl_internal.h | 2 ++ tools/libxl/libxl_remus.c | 9 +++++++++ 3 files changed, 12 insertions(+), 9 deletions(-)
tools/libxl/libxl_checkpoint_device.c +1 -9
@@ -17,14 +17,6 @@#include "libxl_internal.h" -extern const libxl__checkpoint_device_instance_ops remus_device_nic; -extern const libxl__checkpoint_device_instance_ops remus_device_drbd_disk; -static const libxl__checkpoint_device_instance_ops *remus_ops[] = { - &remus_device_nic, - &remus_device_drbd_disk, -NULL , -}; -/*----- helper functions -----*/ static int init_device_subkind (libxl__checkpoint_devices_state *cds)
@@ -172,7 +164,7 @@ static void device_setup_iterate(libxl__egc *egc, libxl__ao_device *aodev) goto out; do { - dev->ops = remus_ops[++dev->ops_index]; + dev->ops = dev->cds->ops[++dev->ops_index]; if (!dev->ops) { libxl_device_nic * nic = NULL; libxl_device_disk * disk = NULL;
tools/libxl/libxl_internal.h +2 -0
@@ -2895,6 +2895,8 @@ struct libxl__checkpoint_devices_state {uint32_t domid;libxl__checkpoint_callback *callback;int device_kind_flags; +/* The ops must be pointer array, and the last ops must be NULL */ +const libxl__checkpoint_device_instance_ops **ops;/*----- private for abstract layer only -----*/
tools/libxl/libxl_remus.c +9 -0
@@ -18,6 +18,14 @@#include "libxl_internal.h" +extern const libxl__checkpoint_device_instance_ops remus_device_nic; +extern const libxl__checkpoint_device_instance_ops remus_device_drbd_disk; +static const libxl__checkpoint_device_instance_ops *remus_ops[] = { + &remus_device_nic, + &remus_device_drbd_disk, +NULL , +}; +/*-------------------- Remus setup and teardown ---------------------*/ static void remus_setup_done(libxl__egc *egc,
@@ -50,6 +58,7 @@ void libxl__remus_setup(libxl__egc *egc, cds->ao = ao; cds->domid = dss->domid; cds->callback = remus_setup_done; + cds->ops = remus_ops; dss->sws.checkpoint_callback = remus_checkpoint_stream_written;
Signature · 1 line
2.5.0
PATCH v5 17/18 tools/libxl: move remus state into a seperate structure
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
Add a new structure remus state, and move concrete layer's private member to remus state.
it is pure refactoring and no functional changes.
Init interval in libxl__remus_setup(). It is safe to move this initialisation, because this value is only used for remus, and remus will use this value after libxl__remus_setup().
--- tools/libxl/libxl.c | 2 +- tools/libxl/libxl_dom_save.c | 3 +-- tools/libxl/libxl_internal.h | 35 +++++++++++++++----------- tools/libxl/libxl_netbuffer.c | 49 +++++++++++++++++++++---------------- tools/libxl/libxl_remus.c | 24 ++++++++++++------ tools/libxl/libxl_remus_disk_drbd.c | 8 +++--- 6 files changed, 72 insertions(+), 49 deletions(-)
tools/libxl/libxl.c +1 -1
@@ -882,7 +882,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info,assert (info);/* Point of no return */ -libxl__remus_setup (egc, dss); +libxl__remus_setup (egc, &dss->rs);return AO_INPROGRESS ; out:
tools/libxl/libxl_dom_save.c +1 -2
@@ -392,7 +392,6 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) }if (dss->checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_REMUS ) { - dss->interval = r_info->interval;if (libxl_defbool_val (r_info->compression)) dss->xcflags |=XCFLAGS_CHECKPOINT_COMPRESS ; }
@@ -538,7 +537,7 @@ static void domain_save_done(libxl__egc *egc,* from sending checkpoints. Teardown the network buffers and * release netlink resources. This is an async op. */ -libxl__remus_teardown (egc, dss, rc); +libxl__remus_teardown (egc, &dss->rs, rc);return ; }
tools/libxl/libxl_internal.h +21 -14
@@ -2894,6 +2894,7 @@ struct libxl__checkpoint_devices_state {libxl__ao *ao;uint32_t domid;libxl__checkpoint_callback *callback; +void *concrete_data;int device_kind_flags;/* The ops must be pointer array, and the last ops must be NULL */ const libxl__checkpoint_device_instance_ops **ops;
@@ -2917,16 +2918,6 @@ struct libxl__checkpoint_devices_state {int num_disks;libxl__multidev multidev; - -/*----- private for concrete (device-specific) layer only -----*/ - -/* private for nic device subkind ops */ -char *netbufscript; -struct nl_sock *nlsock; -struct nl_cache *qdisc_cache; - -/* private for drbd disk subkind ops */ -char *drbd_probe_script; };/*
@@ -2974,6 +2965,23 @@ _hidden void libxl__checkpoint_devices_preresume(libxl__egc *egc, libxl__checkpoint_devices_state *cds); _hidden void libxl__checkpoint_devices_commit(libxl__egc *egc,libxl__checkpoint_devices_state *cds); + +/*----- Remus related state structure -----*/ +typedef struct libxl__remus_state libxl__remus_state ; +struct libxl__remus_state { +/* private */ +libxl__ev_time checkpoint_timeout;/* used for Remus checkpoint */ +int interval;/* checkpoint interval */ + +/*----- private for concrete (device-specific) layer only -----*/ +/* private for nic device subkind ops */ +char *netbufscript; +struct nl_sock *nlsock; +struct nl_cache *qdisc_cache; + +/* private for drbd disk subkind ops */ +char *drbd_probe_script; +}; _hidden int libxl__netbuffer_enabled(libxl__gc *gc);/*----- Legacy conversion helper -----*/
@@ -3132,9 +3140,8 @@ struct libxl__domain_save_state {int hvm;int xcflags;libxl__domain_suspend_state dsps; +libxl__remus_state rs;libxl__checkpoint_devices_state cds; -libxl__ev_time checkpoint_timeout;/* used for Remus checkpoint */ -int interval;/* checkpoint interval (for Remus) */ libxl__stream_write_state sws;libxl__logdirty_switch logdirty;/* private for libxl__domain_save_device_model */
@@ -3554,9 +3561,9 @@ _hidden void libxl__remus_domain_resume_callback(void *data); _hidden void libxl__remus_domain_save_checkpoint_callback(void *data);/* Remus setup and teardown*/ _hidden void libxl__remus_setup(libxl__egc *egc, -libxl__domain_save_state *dss); +libxl__remus_state *rs); _hidden void libxl__remus_teardown(libxl__egc *egc, -libxl__domain_save_state *dss, +libxl__remus_state *rs,int rc);/* Remus callbacks for restore */ _hidden void libxl__remus_domain_restore_checkpoint_callback(void *data);
tools/libxl/libxl_netbuffer.c +28 -21
146 lines not on this page · raw message
tools/libxl/libxl_remus.c +16 -8
@@ -35,9 +35,10 @@ static void remus_setup_failed(libxl__egc *egc,static void remus_checkpoint_stream_written (libxl__egc *egc,libxl__stream_write_state *sws,int rc); -void libxl__remus_setup (libxl__egc *egc, -libxl__domain_save_state *dss) +void libxl__remus_setup (libxl__egc *egc,libxl__remus_state *rs) { +libxl__domain_save_state *dss =CONTAINER_OF (rs, *dss, rs); +/* Convenience aliases */ libxl__checkpoint_devices_state *const cds = &dss->cds;const libxl_domain_remus_info *const info = dss->remus;
@@ -59,6 +60,8 @@ void libxl__remus_setup(libxl__egc *egc, cds->domid = dss->domid; cds->callback = remus_setup_done; cds->ops = remus_ops; + cds->concrete_data = rs; + rs->interval = info->interval; dss->sws.checkpoint_callback = remus_checkpoint_stream_written;
@@ -103,15 +106,20 @@ static void remus_teardown_done(libxl__egc *egc,libxl__checkpoint_devices_state *cds, int rc);void libxl__remus_teardown (libxl__egc *egc, -libxl__domain_save_state *dss, +libxl__remus_state *rs,int rc) { +libxl__domain_save_state *dss =CONTAINER_OF (rs, *dss, rs); + +/* Convenience aliases */ +libxl__checkpoint_devices_state *const cds = &dss->cds; +EGC_GC ;LOG (WARN ,"Remus: Domain suspend terminated with rc %d," " teardown Remus devices..." , rc); - dss->cds.callback = remus_teardown_done; -libxl__checkpoint_devices_teardown (egc, &dss->cds); + cds->callback = remus_teardown_done; +libxl__checkpoint_devices_teardown (egc, cds); } static void remus_teardown_done(libxl__egc *egc,
@@ -285,9 +293,9 @@ static void remus_devices_commit_cb(libxl__egc *egc,*/ /* Set checkpoint interval timeout */ - rc =libxl__ev_time_register_rel (ao, &dss->checkpoint_timeout, + rc =libxl__ev_time_register_rel (ao, &dss->rs.checkpoint_timeout, remus_next_checkpoint, - dss->interval); + dss->rs.interval);if (rc) goto out;
@@ -303,7 +311,7 @@ static void remus_next_checkpoint(libxl__egc *egc, libxl__ev_time *ev, int rc) {libxl__domain_save_state *dss = -CONTAINER_OF (ev, *dss, checkpoint_timeout); +CONTAINER_OF (ev, *dss, rs.checkpoint_timeout);STATE_AO_GC (dss->ao);
tools/libxl/libxl_remus_disk_drbd.c +5 -3
@@ -28,10 +28,11 @@ typedef struct libxl__remus_drbd_disk {int init_subkind_drbd_disk (libxl__checkpoint_devices_state *cds) { +libxl__remus_state *rs = cds->concrete_data;STATE_AO_GC (cds->ao); - cds->drbd_probe_script =GCSPRINTF ("%s/block-drbd-probe" , -libxl__xen_script_dir_path ()); + rs->drbd_probe_script =GCSPRINTF ("%s/block-drbd-probe" , +libxl__xen_script_dir_path ());return 0 ; }
@@ -96,6 +97,7 @@ static void match_async_exec(libxl__egc *egc, libxl__checkpoint_device *dev)int arraysize, nr =0 , rc;const libxl_device_disk *disk = dev->backend_dev;libxl__async_exec_state *aes = &dev->aodev.aes; +libxl__remus_state *rs = dev->cds->concrete_data;STATE_AO_GC (dev->cds->ao);/* setup env & args */
@@ -107,7 +109,7 @@ static void match_async_exec(libxl__egc *egc, libxl__checkpoint_device *dev) arraysize =3 ; nr =0 ;GCNEW_ARRAY (aes->args, arraysize); - aes->args[nr++] = dev->cds->drbd_probe_script; + aes->args[nr++] = rs->drbd_probe_script; aes->args[nr++] = disk->pdev_path; aes->args[nr++] =NULL ;assert (nr <= arraysize);
Signature · 1 line
2.5.0
PATCH v5 18/18 tools/libxl: seperate device init/cleanup from checkpoint device layer
In reply to Wen CongyangFrom: Yang Hongyang <[email protected]>
we call (init|cleanup)_subkind_nic and (init|cleanup)_subkind_drbd_disk directly in checkpoint device. Move them to libxl_remus.c, Call them before calling libxl__checkpoint_devices_setup() or after calling libxl__checkpoint_devices_teardown().
it is pure refactoring and no functional changes.
--- tools/libxl/libxl_checkpoint_device.c | 42 ++--------------------------------- tools/libxl/libxl_remus.c | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 40 deletions(-)
tools/libxl/libxl_checkpoint_device.c +2 -40
@@ -17,38 +17,6 @@#include "libxl_internal.h" -/*----- helper functions -----*/ - -static int init_device_subkind (libxl__checkpoint_devices_state *cds) -{ -/* init device subkind-specific state in the libxl ctx */ -int rc; -STATE_AO_GC (cds->ao); - -if (libxl__netbuffer_enabled (gc)) { - rc =init_subkind_nic (cds); -if (rc) goto out; - } - - rc =init_subkind_drbd_disk (cds); -if (rc) goto out; - - rc =0 ; -out: -return rc; -} - -static void cleanup_device_subkind (libxl__checkpoint_devices_state *cds) -{ -/* cleanup device subkind-specific state in the libxl ctx */ -STATE_AO_GC (cds->ao); - -if (libxl__netbuffer_enabled (gc)) -cleanup_subkind_nic (cds); - -cleanup_subkind_drbd_disk (cds); -} -/*----- setup() and teardown() -----*/ /* callbacks */
@@ -86,14 +54,10 @@ static void checkpoint_devices_setup(libxl__egc *egc,void libxl__checkpoint_devices_setup (libxl__egc *egc,libxl__checkpoint_devices_state *cds) { -int i, rc; +int i;STATE_AO_GC (cds->ao); - rc =init_device_subkind (cds); -if (rc) - goto out; - cds->num_devices =0 ; cds->num_nics =0 ; cds->num_disks =0 ;
@@ -126,7 +90,7 @@ void libxl__checkpoint_devices_setup(libxl__egc *egc,return ; out: - cds->callback (egc, cds, rc); + cds->callback (egc, cds,0 ); } static void checkpoint_devices_setup(libxl__egc *egc,
@@ -263,8 +227,6 @@ static void devices_teardown_cb(libxl__egc *egc, cds->disks =NULL ; cds->num_disks =0 ; -cleanup_device_subkind (cds); - cds->callback (egc, cds, rc); }
tools/libxl/libxl_remus.c +42 -0
66 lines not on this page · raw message
Signature · 1 line
2.5.0
Wen Congyang writes ("[PATCH v5 COLOPre 00/18] Prerequisite patches for COLO"):
Quoted 2 lines
This patchset is Prerequisite for COLO feature. Refer to:
http://wiki.xen.org/wiki/COLO_-_Coarse_Grain_Lock_Stepping
Thanks for this. I see no-one has replied yet. I wanted to reply to say that this is on my radar and I hope to look into it soon. ATM I'm dealing with rather an email backlog.
Ian.
Quoted 7 lines · Ian Jackson
Wen Congyang writes ("[PATCH v5 COLOPre 00/18] Prerequisite patches for COLO"):
Quoted 2 lines
This patchset is Prerequisite for COLO feature. Refer to:
http://wiki.xen.org/wiki/COLO_-_Coarse_Grain_Lock_SteppingThanks for this. I see no-one has replied yet. I wanted to reply to say that this is on my radar and I hope to look into it soon. ATM I'm dealing with rather an email backlog.
Ping... When do you have time to review it? I have sent out a new version:
http://lists.xenproject.org/archives/html/xen-devel/2015-12/msg02884.html
Thanks
Wen Congyang
Quoted 6 lines
Ian.
.