[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 01/18] libxl/remus: init checkpoint_callback in Remus setup callback



On Wed, Dec 30, 2015 at 10:28:51AM +0800, Wen Congyang wrote:
> 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.
> 
> Signed-off-by: Yang Hongyang <hongyang.yang@xxxxxxxxxxxx>
> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
> CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
>  tools/libxl/libxl.c          |  2 ++
>  tools/libxl/libxl_create.c   | 10 +++++++++-
>  tools/libxl/libxl_dom.c      |  5 +----
>  tools/libxl/libxl_internal.h |  4 ++++
>  4 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 9207621..d340a20 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -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;
>  
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 261816a..6ea9bc2 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -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
> @@ -995,6 +1001,7 @@ static void domcreate_bootloader_done(libxl__egc *egc,
>      libxl__domain_build_state *const state = &dcs->build_state;
>      libxl__srm_restore_autogen_callbacks *const callbacks =
>          &dcs->srs.shs.callbacks.restore.a;
> +    const int checkpointed_stream = dcs->restore_params.checkpointed_stream;
>  
>      if (rc) {
>          domcreate_rebuild_done(egc, dcs, rc);
> @@ -1033,9 +1040,10 @@ 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) {
> +        if (checkpointed_stream)
> +            libxl__remus_restore_setup(egc, dcs);
>          libxl__stream_read_start(egc, &dcs->srs);
>          return;
>      }
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 2269998..9e28bc4 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -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;
>  
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 630172b..45d7961 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -3507,6 +3507,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.
> -- 
> 2.5.0
> 
> 
> 
> 
> _______________________________________________
> 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.