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

Re: [Xen-devel] [PATCH v7 32/32] libxl: add support for migrating HVM guests without a device model



On 02/10/15 16:49, Roger Pau Monne wrote:
> Only some minor libxl changes are needed in order to be able to migrate HVM
> guests without a device model, no hypervisor changes are needed.
>
> This change prevents sending the emulator context if the device model
> version is set to none.
>
> Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  tools/libxl/libxl_dom.c          | 3 +++
>  tools/libxl/libxl_dom_suspend.c  | 2 ++
>  tools/libxl/libxl_stream_write.c | 8 +++++++-
>  3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index 7e8ae14..b40d744 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -1310,6 +1310,9 @@ void libxl__domain_suspend_common_switch_qemu_logdirty
>      case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
>          domain_suspend_switch_qemu_xen_logdirty(domid, enable, shs);
>          break;
> +    case LIBXL_DEVICE_MODEL_VERSION_NONE:
> +        libxl__xc_domain_saverestore_async_callback_done(egc, shs, 0);
> +        break;
>      default:
>          LOG(ERROR,"logdirty switch failed"
>              ", no valid device model version found, abandoning suspend");
> diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
> index 4cc01ad..3313ad1 100644
> --- a/tools/libxl/libxl_dom_suspend.c
> +++ b/tools/libxl/libxl_dom_suspend.c
> @@ -43,6 +43,8 @@ int libxl__domain_suspend_device_model(libxl__gc *gc,
>          if (ret)
>              unlink(filename);
>          break;
> +    case LIBXL_DEVICE_MODEL_VERSION_NONE:
> +        break;
>      default:
>          return ERROR_INVAL;
>      }
> diff --git a/tools/libxl/libxl_stream_write.c 
> b/tools/libxl/libxl_stream_write.c
> index 52a60d7..5551560 100644
> --- a/tools/libxl/libxl_stream_write.c
> +++ b/tools/libxl/libxl_stream_write.c
> @@ -232,6 +232,9 @@ void libxl__stream_write_start(libxl__egc *egc,
>              stream->emu_sub_hdr.id = EMULATOR_QEMU_UPSTREAM;
>              break;
>  
> +        case LIBXL_DEVICE_MODEL_VERSION_NONE:
> +            break;
> +
>          default:
>              rc = ERROR_FAIL;
>              LOG(ERROR, "Unknown emulator for HVM domain");
> @@ -387,8 +390,11 @@ static void emulator_xenstore_record_done(libxl__egc 
> *egc,
>                                            libxl__stream_write_state *stream)
>  {
>      libxl__domain_suspend_state *dss = stream->dss;
> +    STATE_AO_GC(stream->ao);
>  
> -    if (dss->type == LIBXL_DOMAIN_TYPE_HVM)
> +    if (dss->type == LIBXL_DOMAIN_TYPE_HVM &&
> +        libxl__device_model_version_running(gc, dss->domid) !=
> +        LIBXL_DEVICE_MODEL_VERSION_NONE)
>          write_emulator_context_record(egc, stream);
>      else {
>          if (stream->in_checkpoint)

I think a few more changes are needed to make this robust.

write_emulator_xenstore_record() needs an early check for
LIBXL_DEVICE_MODEL_VERSION_NONE and omit the call to
libxl__save_emulator_xenstore_data() (which is only needed because
qemu-upstream has a layering violation in its save format)

Instead of patching emulator_xenstore_record_done(), in the hunk above,
I would suggest having another early check and continue in
write_emulator_context_record()

Also, you need to patch the EMULATOR_* cases in
libxl_stream_read.c:process_record() to bail with a hard error if
records received for a domain configured to have no emulators.

~Andrew

_______________________________________________
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®.