[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC v3 08/12] Migration with Local Disks Mirroring: New stream phase type for libxl streams
The libxl streams are classified by a stream phase parameter (stream_phase): 0. DEFAULT: This is the stream phase when no local disks are being mirrored as part of the domain save or restore flow. (=0) 1. POST_MIRROR_DISKS: This stream phase happens during the migration flow after the disks have been completely mirrored. In time order, this is the second libxl stream of the migration flow. (=1) 2. PRE_MIRROR_DISKS: This stream happens before the disks start to be mirrored to the destination. In time order, this is the first libxl stream of the migration flow. (=2) libxl__xc_mirror_disks_restore_returned is the callback function in the libxl_read_stream that is registered for the return of libxc_mirror_disks stream. Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx> --- tools/libxc/include/xenguest.h | 3 ++- tools/libxc/xc_nomigrate.c | 3 ++- tools/libxc/xc_sr_restore.c | 3 ++- tools/libxl/libxl_colo_restore.c | 4 ++-- tools/libxl/libxl_internal.h | 12 +++++++++++- tools/libxl/libxl_save_callout.c | 13 +++++++++---- tools/libxl/libxl_save_helper.c | 5 ++++- tools/libxl/libxl_stream_read.c | 24 ++++++++++++++++++++++-- tools/libxl/libxl_types.idl | 6 ++++++ 9 files changed, 60 insertions(+), 13 deletions(-) diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h index b4b2e19..014dee0 100644 --- a/tools/libxc/include/xenguest.h +++ b/tools/libxc/include/xenguest.h @@ -199,7 +199,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_mfn, uint32_t console_domid, unsigned int hvm, unsigned int pae, xc_migration_stream_t stream_type, - struct restore_callbacks *callbacks, int send_back_fd); + struct restore_callbacks *callbacks, int send_back_fd, + int stream_phase); /** * This function will create a domain for a paravirtualized Linux diff --git a/tools/libxc/xc_nomigrate.c b/tools/libxc/xc_nomigrate.c index 6d6169d..75fe560 100644 --- a/tools/libxc/xc_nomigrate.c +++ b/tools/libxc/xc_nomigrate.c @@ -34,7 +34,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_mfn, uint32_t console_domid, unsigned int hvm, unsigned int pae, xc_migration_stream_t stream_type, - struct restore_callbacks *callbacks, int send_back_fd) + struct restore_callbacks *callbacks, int send_back_fd, + int stream_phase) { errno = ENOSYS; return -1; diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c index ea7b033..7f74d28 100644 --- a/tools/libxc/xc_sr_restore.c +++ b/tools/libxc/xc_sr_restore.c @@ -829,7 +829,8 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, unsigned long *console_gfn, uint32_t console_domid, unsigned int hvm, unsigned int pae, xc_migration_stream_t stream_type, - struct restore_callbacks *callbacks, int send_back_fd) + struct restore_callbacks *callbacks, int send_back_fd, + int stream_phase) { xen_pfn_t nr_pfns; struct xc_sr_context ctx = diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c index 0c535bd..a45bf51 100644 --- a/tools/libxl/libxl_colo_restore.c +++ b/tools/libxl/libxl_colo_restore.c @@ -132,7 +132,7 @@ static void colo_resume_vm(libxl__egc *egc, return; } - libxl__xc_domain_restore_done(egc, dcs, 0, 0, 0); + libxl__xc_domain_restore_done(egc, dcs, dcs->srs, 0, 0, 0); return; } @@ -325,7 +325,7 @@ void libxl__colo_restore_teardown(libxl__egc *egc, void *dcs_void, /* crcs->status is LIBXL_COLO_SETUPED */ dcs->srs.completion_callback = NULL; } - libxl__xc_domain_restore_done(egc, dcs, ret, retval, errnoval); + libxl__xc_domain_restore_done(egc, dcs, dcs->srs, ret, retval, errnoval); if (crs->qdisk_setuped) { libxl__qmp_stop_replication(gc, crs->domid, false); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index feb9370..76bbe48 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3825,13 +3825,23 @@ _hidden int libxl__restore_emulator_xenstore_data _hidden void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, libxl__save_helper_state *shs, - int hvm, int pae); + int hvm, int pae, int stream_phase); /* If rc==0 then retval is the return value from xc_domain_save * and errnoval is the errno value it provided. * If rc!=0, retval and errnoval are undefined. */ _hidden void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, + libxl__stream_read_state *stream, int rc, int retval, int errnoval); +_hidden void libxl__xc_domain_restore_returned(libxl__egc *egc, void *dcs_void, + int rc, int retval, + int errnoval); + +_hidden void libxl__xc_mirror_disks_restore_returned(libxl__egc *egc, + void *dcs_void, + int rc, int retval, + int errnoval); + _hidden void libxl__save_helper_init(libxl__save_helper_state *shs); _hidden void libxl__save_helper_abort(libxl__egc *egc, libxl__save_helper_state *shs); diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c index 6452d70..0ff9a01 100644 --- a/tools/libxl/libxl_save_callout.c +++ b/tools/libxl/libxl_save_callout.c @@ -43,7 +43,7 @@ static void helper_done(libxl__egc *egc, libxl__save_helper_state *shs); void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, libxl__save_helper_state *shs, - int hvm, int pae) + int hvm, int pae, int stream_phase) { STATE_AO_GC(dcs->ao); @@ -63,16 +63,21 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, state->console_domid, hvm, pae, cbflags, dcs->restore_params.checkpointed_stream, + stream_phase, }; shs->ao = ao; shs->domid = domid; shs->recv_callback = libxl__srm_callout_received_restore; if (dcs->restore_params.checkpointed_stream == - LIBXL_CHECKPOINTED_STREAM_COLO) + LIBXL_CHECKPOINTED_STREAM_COLO) { shs->completion_callback = libxl__colo_restore_teardown; - else - shs->completion_callback = libxl__xc_domain_restore_done; + } else { + if ( stream_phase != LIBXL_STREAM_PHASE_PRE_MIRROR_DISKS ) + shs->completion_callback = libxl__xc_domain_restore_returned; + else + shs->completion_callback = libxl__xc_mirror_disks_restore_returned; + } shs->caller_state = dcs; shs->need_results = 1; diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c index 38089a0..f1e8dca 100644 --- a/tools/libxl/libxl_save_helper.c +++ b/tools/libxl/libxl_save_helper.c @@ -279,6 +279,7 @@ int main(int argc, char **argv) unsigned int pae = strtoul(NEXTARG,0,10); unsigned cbflags = strtoul(NEXTARG,0,10); xc_migration_stream_t stream_type = strtoul(NEXTARG,0,10); + int stream_phase = atoi(NEXTARG); assert(!*++argv); helper_setcallbacks_restore(&helper_restore_callbacks, cbflags); @@ -293,7 +294,9 @@ int main(int argc, char **argv) store_domid, console_evtchn, &console_mfn, console_domid, hvm, pae, stream_type, - &helper_restore_callbacks, send_back_fd); + &helper_restore_callbacks, send_back_fd, + stream_phase); + helper_stub_restore_results(store_mfn,console_mfn,0); complete(r); diff --git a/tools/libxl/libxl_stream_read.c b/tools/libxl/libxl_stream_read.c index fcb39ee..4c845c5 100644 --- a/tools/libxl/libxl_stream_read.c +++ b/tools/libxl/libxl_stream_read.c @@ -561,6 +561,7 @@ static bool process_record(libxl__egc *egc, { STATE_AO_GC(stream->ao); libxl__domain_create_state *dcs = stream->dcs; + int create_mirror_disks = stream->dcs->mirror_disks; libxl__sr_record_buf *rec; libxl_sr_checkpoint_state *srcs; bool further_action_needed = false; @@ -580,7 +581,9 @@ static bool process_record(libxl__egc *egc, break; case REC_TYPE_LIBXC_CONTEXT: - libxl__xc_domain_restore(egc, dcs, &stream->shs, 0, 0); + libxl__xc_domain_restore(egc, dcs, &stream->shs, 0, 0, + stream->mirror_disks + + create_mirror_disks); break; case REC_TYPE_EMULATOR_XENSTORE_DATA: @@ -834,10 +837,10 @@ static void stream_done(libxl__egc *egc, } void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, + libxl__stream_read_state *stream, int rc, int retval, int errnoval) { libxl__domain_create_state *dcs = dcs_void; - libxl__stream_read_state *stream = &dcs->srs; STATE_AO_GC(dcs->ao); /* convenience aliases */ @@ -894,6 +897,23 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, } } +void libxl__xc_domain_restore_returned(libxl__egc *egc, void *dcs_void, + int rc, int retval, int errnoval) +{ + libxl__domain_create_state *dcs = dcs_void; + libxl__stream_read_state *stream = &dcs->srs; + libxl__xc_domain_restore_done(egc, dcs_void, stream, rc, retval, errnoval); +} + +void libxl__xc_mirror_disks_restore_returned(libxl__egc *egc, void *dcs_void, + int rc, int retval, int errnoval) +{ + libxl__domain_create_state *dcs = dcs_void; + libxl__stream_read_state *stream = &dcs->srs_mirror_disks; + libxl__xc_domain_restore_done(egc, dcs_void, stream, rc, retval, errnoval); + +} + static void conversion_done(libxl__egc *egc, libxl__conversion_helper_state *chs, int rc) { diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index a239324..3775f25 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -242,6 +242,12 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_stream_phase = Enumeration("stream_phase", [ + (0, "DEFAULT"), + (1, "POST_MIRROR_DISKS"), + (2, "PRE_MIRROR_DISKS"), + ]) + libxl_vuart_type = Enumeration("vuart_type", [ (0, "unknown"), (1, "sbsa_uart"), -- 2.3.2 (Apple Git-55) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |