libxc: move migration_stream's definition to xenguest.h
PATCH v3 1/3 libxc: move migration_stream's definition to xenguest.h
xc_domain_save() and xc_domain_restore's parameter will use this type, so it should be public.
---v2->v3: Rename MIG_STREAM_* to XC_MIG_STREAM_*
tools/libxc/include/xenguest.h | 7 ++++++- tools/libxc/xc_sr_common.h | 10 ---------- tools/libxc/xc_sr_save.c | 12 ++++++------ 3 files changed, 12 insertions(+), 17 deletions(-)
tools/libxc/include/xenguest.h +6 -1
@@ -75,13 +75,18 @@ struct save_callbacks {void * data; }; +typedef enum { +XC_MIG_STREAM_NONE ,/* plain stream */ +XC_MIG_STREAM_REMUS , +}xc_migration_stream_t ; +/** * This function will save a running domain. * * @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 +* @param checkpointed_stream XC_MIG_STREAM_NONE if the far end of the stream * doesn't use checkpointing * @return 0 on success, -1 on failure */
tools/libxc/xc_sr_common.h +0 -10
@@ -180,16 +180,6 @@ 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. */
tools/libxc/xc_sr_save.c +6 -6
@@ -629,7 +629,7 @@ static int send_domain_memory_live(struct xc_sr_context *ctx)if ( rc ) goto out; -if ( ctx->save.debug && ctx->save.checkpointed !=MIG_STREAM_NONE ) +if ( ctx->save.debug && ctx->save.checkpointed !=XC_MIG_STREAM_NONE ) { rc =verify_frames (ctx);if ( rc )
@@ -758,7 +758,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 !=MIG_STREAM_NONE ) +else if ( ctx->save.checkpointed !=XC_MIG_STREAM_NONE ) rc =send_domain_memory_checkpointed (ctx);else rc =send_domain_memory_nonlive (ctx);
@@ -778,7 +778,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; -if ( ctx->save.checkpointed !=MIG_STREAM_NONE ) +if ( ctx->save.checkpointed !=XC_MIG_STREAM_NONE ) {/* * We have now completed the initial live portion of the checkpoint
@@ -799,7 +799,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc <=0 ) goto err; } - }while ( ctx->save.checkpointed !=MIG_STREAM_NONE ); + }while ( ctx->save.checkpointed !=XC_MIG_STREAM_NONE );xc_report_progress_single (xch,"End of stream" );
@@ -845,8 +845,8 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.checkpointed = checkpointed_stream;/* If altering migration_stream update this assert too. */ -assert (checkpointed_stream ==MIG_STREAM_NONE || - checkpointed_stream ==MIG_STREAM_REMUS ); +assert (checkpointed_stream ==XC_MIG_STREAM_NONE || + checkpointed_stream ==XC_MIG_STREAM_REMUS );/* * TODO: Find some time to better tweak the live migration algorithm.
Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v3 2/3 tools: change checkpointed_stream's type from int to xc_migration_stream_t
checkpointed_stream is also renamed to stream_type
---v2->v3: Rename checkpointed_stream to stream_type
tools/libxc/include/xenguest.h | 8 ++++---- tools/libxc/xc_nomigrate.c | 4 ++-- tools/libxc/xc_sr_restore.c | 10 +++++----- tools/libxc/xc_sr_save.c | 8 ++++---- tools/libxl/libxl_save_helper.c | 42 ++++++++++++++++++++--------------------- 5 files changed, 36 insertions(+), 36 deletions(-)
tools/libxc/include/xenguest.h +4 -4
@@ -86,14 +86,14 @@ typedef enum {* @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 XC_MIG_STREAM_NONE if the far end of the stream +* @param stream_type XC_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, -int checkpointed_stream); +xc_migration_stream_t stream_type);/* callbacks provided by xc_domain_restore */ struct restore_callbacks {
@@ -121,7 +121,7 @@ struct restore_callbacks {* @parm hvm non-zero if this is a HVM restore * @parm pae non-zero if this HVM domain has PAE support enabled * @parm superpages non-zero to allocate guest memory with superpages -* @parm checkpointed_stream non-zero if the far end of the stream is using checkpointing +* @parm stream_type non-zero if the far end of the stream is using checkpointing * @parm callbacks non-NULL to receive a callback to restore toolstack * specific data * @return 0 on success, -1 on failure
@@ -131,7 +131,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, domid_t store_domid, unsigned int console_evtchn, unsigned long *console_mfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, - int checkpointed_stream, + xc_migration_stream_t stream_type, struct restore_callbacks *callbacks);/**
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) +xc_migration_stream_t stream_type) { errno =ENOSYS ;return -1 ;
@@ -34,7 +34,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, domid_t store_domid, unsigned int console_evtchn, unsigned long *console_mfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, - int checkpointed_stream, + xc_migration_stream_t stream_type, struct restore_callbacks *callbacks) { errno =ENOSYS ;
tools/libxc/xc_sr_restore.c +5 -5
@@ -725,7 +725,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, domid_t store_domid, unsigned int console_evtchn, unsigned long *console_gfn, domid_t console_domid, unsigned int hvm, unsigned int pae, int superpages, - int checkpointed_stream, + xc_migration_stream_t stream_type, struct restore_callbacks *callbacks) { struct xc_sr_context ctx =
@@ -739,16 +739,16 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom, ctx.restore.console_domid = console_domid; ctx.restore.xenstore_evtchn = store_evtchn; ctx.restore.xenstore_domid = store_domid; - ctx.restore.checkpointed = checkpointed_stream; + ctx.restore.checkpointed = stream_type; ctx.restore.callbacks = callbacks;/* Sanity checks for callbacks. */ -if ( checkpointed_stream ) +if ( stream_type )assert (callbacks->checkpoint);DPRINTF ("fd %d, dom %u, hvm %u, pae %u, superpages %d" -", checkpointed_stream %d" , io_fd, dom, hvm, pae, - superpages, checkpointed_stream); +", stream_type %d" , io_fd, dom, hvm, pae, + superpages, stream_type);if (xc_domain_getinfo (xch, dom,1 , &ctx.dominfo) !=1 ) {
tools/libxc/xc_sr_save.c +4 -4
@@ -830,7 +830,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) +xc_migration_stream_t stream_type) {struct xc_sr_context ctx = {
@@ -842,11 +842,11 @@ 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 = checkpointed_stream; + ctx.save.checkpointed = stream_type;/* If altering migration_stream update this assert too. */ -assert (checkpointed_stream ==XC_MIG_STREAM_NONE || - checkpointed_stream ==XC_MIG_STREAM_REMUS ); +assert (stream_type ==XC_MIG_STREAM_NONE || + stream_type ==XC_MIG_STREAM_REMUS );/* * TODO: Find some time to better tweak the live migration algorithm.
tools/libxl/libxl_save_helper.c +21 -21
64 lines not on this page · raw message
Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v3 2/3] tools: change checkpointed_stream's type from int to xc_migration_stream_t
Quoted 3 lines · Wen Congyang
checkpointed_streamis also renamed tostream_typeSigned-off-by Wen Congyang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v3 3/3 libxl: rename checkpointed_stream to stream_type
In reply to Wen Congyang--- tools/libxl/libxl.c | 4 ++-- tools/libxl/libxl.h | 8 ++++++++ tools/libxl/libxl_create.c | 4 ++-- tools/libxl/libxl_dom_save.c | 6 +++--- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_save_callout.c | 4 ++-- tools/libxl/libxl_stream_read.c | 4 ++-- tools/libxl/libxl_stream_write.c | 2 +- tools/libxl/libxl_types.idl | 2 +- tools/libxl/xl_cmdimpl.c | 16 ++++++++-------- 10 files changed, 30 insertions(+), 22 deletions(-)
tools/libxl/libxl.c +2 -2
@@ -876,7 +876,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 ; + dss->stream_type =LIBXL_CHECKPOINTED_STREAM_REMUS ;assert (info);
@@ -937,7 +937,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 ; + dss->stream_type =LIBXL_CHECKPOINTED_STREAM_NONE ; rc = libxl__fd_flags_modify_save(gc, dss->fd, ~(O_NONBLOCK|O_NDELAY), 0,
tools/libxl/libxl.h +8 -0
@@ -863,6 +863,14 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);#define LIBXL_HAVE_SRM_V1 1/* +* LIBXL_HAVE_STREAM_TYPE +* +* If this is define, then the libxl_domain_create_restore() interfaces;s +* parameter checkpointed_stream is renamed to stream_type +*/ +#define LIBXL_HAVE_STREAM_TYPE 1 + +/* * libxl_domain_build_info has the u.hvm.gfx_passthru_kind field and * the libxl_gfx_passthru_kind enumeration is defined. */
tools/libxl/libxl_create.c +2 -2
@@ -993,7 +993,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,libxl_domain_config *const d_config = dcs->guest_config;const int restore_fd = dcs->restore_fd;libxl__domain_build_state *const state = &dcs->build_state; -const int checkpointed_stream = dcs->restore_params.checkpointed_stream; +const int stream_type = dcs->restore_params.stream_type;if (rc) {domcreate_rebuild_done (egc, dcs, rc);
@@ -1033,7 +1033,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, dcs->srs.completion_callback = domcreate_stream_done;if (restore_fd >=0 ) { -switch (checkpointed_stream) { +switch (stream_type) {case LIBXL_CHECKPOINTED_STREAM_REMUS :libxl__remus_restore_setup (egc, dcs);/* fall through */
tools/libxl/libxl_dom_save.c +3 -3
@@ -338,7 +338,7 @@ 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) { +if (dss->stream_type !=LIBXL_CHECKPOINTED_STREAM_NONE && !r_info) {LOG (ERROR ,"Migration stream is checkpointed, but there's no " "checkpoint info!" ); rc =ERROR_INVAL ;
@@ -383,12 +383,12 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) goto out; } -if (dss->checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_REMUS ) { +if (dss->stream_type ==LIBXL_CHECKPOINTED_STREAM_REMUS ) {if (libxl_defbool_val (r_info->compression)) dss->xcflags |=XCFLAGS_CHECKPOINT_COMPRESS ; } -if (dss->checkpointed_stream ==LIBXL_CHECKPOINTED_STREAM_NONE ) +if (dss->stream_type ==LIBXL_CHECKPOINTED_STREAM_NONE ) callbacks->suspend = libxl__domain_suspend_callback; callbacks->switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty;
tools/libxl/libxl_internal.h +1 -1
@@ -3128,7 +3128,7 @@ struct libxl__domain_save_state {libxl_domain_type type;int live;int debug; -int checkpointed_stream; +libxl_checkpointed_stream stream_type;const libxl_domain_remus_info *remus;/* private */ int rc;
tools/libxl/libxl_save_callout.c +2 -2
@@ -61,7 +61,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, state->store_domid, state->console_port, state->console_domid, hvm, pae, superpages, - cbflags, dcs->restore_params.checkpointed_stream, + cbflags, dcs->restore_params.stream_type, }; shs->ao = ao;
@@ -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, dss->checkpointed_stream, + cbflags, dss->stream_type, }; shs->ao = ao;
tools/libxl/libxl_stream_read.c +2 -2
@@ -773,7 +773,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,STATE_AO_GC (dcs->ao);/* convenience aliases */ -const int checkpointed_stream = dcs->restore_params.checkpointed_stream; +const int stream_type = dcs->restore_params.stream_type;if (rc) goto err;
@@ -794,7 +794,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,* If the stream is not still alive, we must not continue any work. */ if (libxl__stream_read_inuse (stream)) { -switch (checkpointed_stream) { +switch (stream_type) {case LIBXL_CHECKPOINTED_STREAM_REMUS :/* * Failover from primary. Domain state is currently at a
tools/libxl/libxl_stream_write.c +1 -1
@@ -355,7 +355,7 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void,* If the stream is not still alive, we must not continue any work. */ if (libxl__stream_write_inuse (stream)) { -if (dss->checkpointed_stream !=LIBXL_CHECKPOINTED_STREAM_NONE ) +if (dss->stream_type !=LIBXL_CHECKPOINTED_STREAM_NONE )/* * For remus, if libxl__xc_domain_save_done() completes, * there was an error sending data to the secondary.
tools/libxl/libxl_types.idl +1 -1
@@ -382,7 +382,7 @@ libxl_domain_create_info = Struct("domain_create_info",[ ], dir=DIR_IN) libxl_domain_restore_params = Struct("domain_restore_params", [ - ("checkpointed_stream", integer), + ("stream_type", integer), ("stream_version", uint32, {'init_val': '1'}), ])
tools/libxl/xl_cmdimpl.c +8 -8
@@ -154,7 +154,7 @@ struct domain_create {int vnc;int vncautopass;int console_autoconnect; -int checkpointed_stream; +int stream_type;const char *config_file;char *extra_config;/* extra config string */ const char *restore_file;
@@ -2890,7 +2890,7 @@ start:libxl_domain_restore_params_init (¶ms); - params.checkpointed_stream = dom_info->checkpointed_stream; + params.stream_type = dom_info->stream_type; params.stream_version = (hdr.mandatory_flags & XL_MANDATORY_FLAG_STREAMv2) ?2 :1 ;
@@ -4435,7 +4435,7 @@ 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, -libxl_checkpointed_stream checkpointed) +libxl_checkpointed_stream stream_type) {uint32_t domid;int rc, rc2;
@@ -4460,7 +4460,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 = checkpointed; + dom_info.stream_type = stream_type; rc =create_domain (&dom_info);if (rc <0 ) {
@@ -4471,7 +4471,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, domid = rc; -switch (checkpointed) { +switch (stream_type) {case LIBXL_CHECKPOINTED_STREAM_REMUS :/* If we are here, it means that the sender (primary) has crashed. * TODO: Split-Brain Check.
@@ -4646,7 +4646,7 @@ int main_restore(int argc, char **argv)int main_migrate_receive (int argc,char **argv) {int debug =0 , daemonize =1 , monitor =1 ; -libxl_checkpointed_stream checkpointed =LIBXL_CHECKPOINTED_STREAM_NONE ; +libxl_checkpointed_stream stream_type =LIBXL_CHECKPOINTED_STREAM_NONE ;int opt; SWITCH_FOREACH_OPT(opt, "Fedr", NULL, "migrate-receive", 0) {
@@ -4661,7 +4661,7 @@ int main_migrate_receive(int argc, char **argv) debug =1 ;break ;case 'r' : - checkpointed =LIBXL_CHECKPOINTED_STREAM_REMUS ; + stream_type =LIBXL_CHECKPOINTED_STREAM_REMUS ;break ; }
@@ -4671,7 +4671,7 @@ int main_migrate_receive(int argc, char **argv) }migrate_receive (debug, daemonize, monitor,STDOUT_FILENO ,STDIN_FILENO , - checkpointed); + stream_type);return 0 ; }
Signature · 9 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v3 3/3] libxl: rename checkpointed_stream to stream_type
Quoted 1 line · Wen Congyang
Signed-off-by Wen Congyang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 3/3] libxl: rename checkpointed_stream to stream_type
In reply to Wen CongyangQuoted 42 lines · Wen Congyang
Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl.c | 4 ++-- tools/libxl/libxl.h | 8 ++++++++ tools/libxl/libxl_create.c | 4 ++-- tools/libxl/libxl_dom_save.c | 6 +++--- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_save_callout.c | 4 ++-- tools/libxl/libxl_stream_read.c | 4 ++-- tools/libxl/libxl_stream_write.c | 2 +- tools/libxl/libxl_types.idl | 2 +- tools/libxl/xl_cmdimpl.c | 16 ++++++++-------- 10 files changed, 30 insertions(+), 22 deletions(-)tools/libxl/libxl.c +2
-2@@ -876,7 +876,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 ; + dss->stream_type =LIBXL_CHECKPOINTED_STREAM_REMUS ;assert (info);@@ -937,7 +937,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 ; + dss->stream_type =LIBXL_CHECKPOINTED_STREAM_NONE ; rc = libxl__fd_flags_modify_save(gc, dss->fd, ~(O_NONBLOCK|O_NDELAY), 0,tools/libxl/libxl.h +0
-0@@ -863,6 +863,14 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src);#define LIBXL_HAVE_SRM_V1 1
tools/libxl/libxl.h void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); · line 873
Quoted 10 lines
tools/libxl/libxl.h +8
-0/* +* LIBXL_HAVE_STREAM_TYPE +* +* If this is define, then the libxl_domain_create_restore() interfaces;s +* parameter checkpointed_stream is renamed to stream_type +*/ +#define LIBXL_HAVE_STREAM_TYPE 1 + +/*
I retract my ack on this patch because Andrew mentioned on IRC that you introduced a new macro.
You should update your old one LIBXL_HAVE_CHECKPOINTED_STREAM instead. The reason is your old code before this patch is not yet released, you can change it at will.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines · Wen Congyang
xc_domain_save()and xc_domain_restore's parameter will use this type, so it should be public.Signed-off-by Wen Congyang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel