[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH: Lazy Restore] xl restore: Add a new "-l" lazy switch.
On Thu, May 29, 2014 at 12:34:47AM +0530, Dushyant Behl wrote: > Add a new "-l" option to xl restore which implies use of lazy restore. > Plumb the lazy argument from libxl to libxc. Currently libxc just prints > a debug message and continue with the conventional process. > > Please note that the lazy restore is to be enabled only for HVM guests. > If "-l" is passed as an argument to non HVM guest then the process will > exit with error. You probably need a documentation entry in the docs directory. Perhaps also explain what 'lazy' restore is versus the normal restore path. Thanks! > > Signed-off-by: Dushyant Behl <myselfdushyantbehl@xxxxxxxxx> > --- > tools/libxc/xc_domain_restore.c | 11 ++++++++++- > tools/libxc/xenguest.h | 2 +- > tools/libxl/libxl_create.c | 14 +++++++++----- > 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 + > tools/libxl/xl_cmdimpl.c | 16 ++++++++++++++-- > tools/libxl/xl_cmdtable.c | 1 + > 9 files changed, 40 insertions(+), 11 deletions(-) > > diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c > index bcb0ae0..f9c506c 100644 > --- a/tools/libxc/xc_domain_restore.c > +++ b/tools/libxc/xc_domain_restore.c > @@ -1409,7 +1409,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 no_incr_generationid, int checkpointed_stream, > - unsigned long *vm_generationid_addr, > + int lazy, unsigned long *vm_generationid_addr, > struct restore_callbacks *callbacks) > { > DECLARE_DOMCTL; > @@ -1470,6 +1470,15 @@ int xc_domain_restore(xc_interface *xch, int io_fd, > uint32_t dom, > > DPRINTF("%s: starting restore of new domid %u", __func__, dom); > > + if ( lazy ) { > + DPRINTF("xc: lazy switch enabled for restore\n"); > + > + if ( !hvm ) { > + PERROR("xc: lazy restore called for non HVM guest"); > + return 1; > + } > + } > + > pagebuf_init(&pagebuf); > memset(&tailbuf, 0, sizeof(tailbuf)); > tailbuf.ishvm = hvm; > diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h > index 1f216cd..269275a 100644 > --- a/tools/libxc/xenguest.h > +++ b/tools/libxc/xenguest.h > @@ -126,7 +126,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 no_incr_generationid, int checkpointed_stream, > - unsigned long *vm_generationid_addr, > + int lazy, unsigned long *vm_generationid_addr, > struct restore_callbacks *callbacks); > /** > * xc_domain_restore writes a file to disk that contains the device > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index d015cf4..f599280 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -1348,8 +1348,8 @@ 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, int checkpointed_stream, > + uint32_t *domid, int restore_fd, > + const libxl_domain_restore_params > *restore_params, > const libxl_asyncop_how *ao_how, > const libxl_asyncprogress_how *aop_console_how) > { > @@ -1361,10 +1361,14 @@ static int do_domain_create(libxl_ctx *ctx, > libxl_domain_config *d_config, > cdcs->dcs.guest_config = d_config; > cdcs->dcs.restore_fd = restore_fd; > cdcs->dcs.callback = domain_create_cb; > - cdcs->dcs.checkpointed_stream = checkpointed_stream; > libxl__ao_progress_gethow(&cdcs->dcs.aop_console_how, aop_console_how); > cdcs->domid_out = domid; > > + if (restore_params) { > + cdcs->dcs.checkpointed_stream = restore_params->checkpointed_stream; > + cdcs->dcs.lazy = restore_params->lazy; > + } > + > initiate_domain_create(egc, &cdcs->dcs); > > return AO_INPROGRESS; > @@ -1388,7 +1392,7 @@ 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, 0, > + return do_domain_create(ctx, d_config, domid, -1, NULL, > ao_how, aop_console_how); > } > > @@ -1399,7 +1403,7 @@ int libxl_domain_create_restore(libxl_ctx *ctx, > libxl_domain_config *d_config, > const libxl_asyncprogress_how > *aop_console_how) > { > return do_domain_create(ctx, d_config, domid, restore_fd, > - params->checkpointed_stream, ao_how, > aop_console_how); > + params, ao_how, aop_console_how); > } > > /* > diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h > index c2b73c4..de8fae6 100644 > --- a/tools/libxl/libxl_internal.h > +++ b/tools/libxl/libxl_internal.h > @@ -2718,6 +2718,7 @@ struct libxl__domain_create_state { > /* private to domain_create */ > int guest_domid; > int checkpointed_stream; > + int lazy; > libxl__domain_build_state build_state; > libxl__bootloader_state bl; > libxl__stub_dm_spawn_state dmss; > diff --git a/tools/libxl/libxl_save_callout.c > b/tools/libxl/libxl_save_callout.c > index e3bda8f..aa8c586 100644 > --- a/tools/libxl/libxl_save_callout.c > +++ b/tools/libxl/libxl_save_callout.c > @@ -60,7 +60,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, no_incr_generationid, > - cbflags, dcs->checkpointed_stream, > + cbflags, dcs->checkpointed_stream, dcs->lazy, > }; > > dcs->shs.ao = ao; > diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c > index c36314c..bd0b04a 100644 > --- a/tools/libxl/libxl_save_helper.c > +++ b/tools/libxl/libxl_save_helper.c > @@ -242,6 +242,7 @@ int main(int argc, char **argv) > int no_incr_genidad = strtoul(NEXTARG,0,10); > unsigned cbflags = strtoul(NEXTARG,0,10); > int checkpointed = strtoul(NEXTARG,0,10); > + int lazy = strtoul(NEXTARG,0,10); > assert(!*++argv); > > helper_setcallbacks_restore(&helper_restore_callbacks, cbflags); > @@ -254,7 +255,7 @@ int main(int argc, char **argv) > r = xc_domain_restore(xch, io_fd, dom, store_evtchn, &store_mfn, > store_domid, console_evtchn, &console_mfn, > console_domid, hvm, pae, superpages, > - no_incr_genidad, checkpointed, &genidad, > + no_incr_genidad, checkpointed, lazy, &genidad, > &helper_restore_callbacks); > helper_stub_restore_results(store_mfn,console_mfn,genidad,0); > complete(r); > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl > index 52f1aa9..6c8355c 100644 > --- a/tools/libxl/libxl_types.idl > +++ b/tools/libxl/libxl_types.idl > @@ -282,6 +282,7 @@ libxl_domain_create_info = Struct("domain_create_info",[ > > libxl_domain_restore_params = Struct("domain_restore_params", [ > ("checkpointed_stream", integer), > + ("lazy", integer), > ]) > > MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT") > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 5195914..2a10193 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -146,6 +146,7 @@ struct domain_create { > int paused; > int dryrun; > int quiet; > + int lazy; > int vnc; > int vncautopass; > int console_autoconnect; > @@ -2045,6 +2046,7 @@ static uint32_t create_domain(struct domain_create > *dom_info) > int daemonize = dom_info->daemonize; > int monitor = dom_info->monitor; > int paused = dom_info->paused; > + int lazy = dom_info->lazy; > int vncautopass = dom_info->vncautopass; > const char *config_file = dom_info->config_file; > const char *extra_config = dom_info->extra_config; > @@ -2237,7 +2239,14 @@ start: > > if ( restoring ) { > libxl_domain_restore_params params; > + libxl_domain_create_info *c_info = &d_config.c_info; > + if ( lazy && (c_info->type != LIBXL_DOMAIN_TYPE_HVM) ) { > + fprintf(stderr, "lazy restore should be called for HVM guest > only"); > + ret = ERROR_INVAL; > + goto error_out; > + } > params.checkpointed_stream = dom_info->checkpointed_stream; > + params.lazy = lazy; > ret = libxl_domain_create_restore(ctx, &d_config, > &domid, restore_fd, > ¶ms, > @@ -3925,7 +3934,7 @@ int main_restore(int argc, char **argv) > const char *config_file = NULL; > struct domain_create dom_info; > int paused = 0, debug = 0, daemonize = 1, monitor = 1, > - console_autoconnect = 0, vnc = 0, vncautopass = 0; > + console_autoconnect = 0, vnc = 0, vncautopass = 0, lazy = 0; > int opt, rc; > static struct option opts[] = { > {"vncviewer", 0, 0, 'V'}, > @@ -3934,7 +3943,7 @@ int main_restore(int argc, char **argv) > {0, 0, 0, 0} > }; > > - SWITCH_FOREACH_OPT(opt, "FhcpdeVA", opts, "restore", 1) { > + SWITCH_FOREACH_OPT(opt, "FhcpdleVA", opts, "restore", 1) { > case 'c': > console_autoconnect = 1; > break; > @@ -3957,6 +3966,8 @@ int main_restore(int argc, char **argv) > case 'A': > vnc = vncautopass = 1; > break; > + case 'l': > + lazy = 1; > } > > if (argc-optind == 1) { > @@ -3977,6 +3988,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.lazy = lazy; > dom_info.vnc = vnc; > dom_info.vncautopass = vncautopass; > dom_info.console_autoconnect = console_autoconnect; > diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c > index 4279b9f..0405c6e 100644 > --- a/tools/libxl/xl_cmdtable.c > +++ b/tools/libxl/xl_cmdtable.c > @@ -167,6 +167,7 @@ struct cmd_spec cmd_table[] = { > "Restore a domain from a saved state", > "[options] [<ConfigFile>] <CheckpointFile>", > "-h Print this help.\n" > + "-l Enable lazy restore.\n" > "-p Do not unpause domain after restoring it.\n" > "-e Do not wait in the background for the death > of the domain.\n" > "-d Enable debug messages.\n" > -- > 1.9.1 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |