diff mbox

libxl: libxl_domain_create_restore has an extra argument

Message ID 1459866012-27081-1-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu April 5, 2016, 2:20 p.m. UTC
In the latest libxenlight code, libxl_domain_create_restore accepts a
new argument. Update libvirt's libxl driver for that. Use the macro
provided by libxenlight to detect which version should be used.

The new parameter (send_back_fd) is set to -1 because libvirt provides
no such fd.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Build test with Xen 4.6.1 (old API) and Xen unstable (new API).
---
 src/libxl/libxl_domain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Wei Liu April 5, 2016, 2:28 p.m. UTC | #1
CC Jim as well

On Tue, Apr 05, 2016 at 03:20:12PM +0100, Wei Liu wrote:
> In the latest libxenlight code, libxl_domain_create_restore accepts a
> new argument. Update libvirt's libxl driver for that. Use the macro
> provided by libxenlight to detect which version should be used.
> 
> The new parameter (send_back_fd) is set to -1 because libvirt provides
> no such fd.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Build test with Xen 4.6.1 (old API) and Xen unstable (new API).
> ---
>  src/libxl/libxl_domain.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 04962a0..aed904b 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -1070,7 +1070,12 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>          ret = libxl_domain_create_new(cfg->ctx, &d_config,
>                                        &domid, NULL, &aop_console_how);
>      } else {
> -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> +        params.checkpointed_stream = 0;
> +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> +                                          restore_fd, -1, &params, NULL,
> +                                          &aop_console_how);
> +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
>          params.checkpointed_stream = 0;
>          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
>                                            restore_fd, &params, NULL,
> -- 
> 2.1.4
>
Ian Jackson April 5, 2016, 3:12 p.m. UTC | #2
Wei Liu writes ("Re: [PATCH] libxl: libxl_domain_create_restore has an extra argument"):
> CC Jim as well
> 
> On Tue, Apr 05, 2016 at 03:20:12PM +0100, Wei Liu wrote:
> > In the latest libxenlight code, libxl_domain_create_restore accepts a
> > new argument. Update libvirt's libxl driver for that. Use the macro
> > provided by libxenlight to detect which version should be used.
> > 
> > The new parameter (send_back_fd) is set to -1 because libvirt provides
> > no such fd.
...
> > -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> > +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> > +        params.checkpointed_stream = 0;
> > +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > +                                          restore_fd, -1, &params, NULL,
> > +                                          &aop_console_how);
> > +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
> >          params.checkpointed_stream = 0;
> >          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> >                                            restore_fd, &params, NULL,

Another approach would be 

             ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
                                               restore_fd,
    #ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD
                                               -1,
    #endif
    #ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
                                               &params,
    #endif
                                               NULL, &aop_console_how);

But which to choose is a matter of taste.

Ian.
Wei Liu April 6, 2016, 11:24 a.m. UTC | #3
On Tue, Apr 05, 2016 at 04:12:57PM +0100, Ian Jackson wrote:
> Wei Liu writes ("Re: [PATCH] libxl: libxl_domain_create_restore has an extra argument"):
> > CC Jim as well
> > 
> > On Tue, Apr 05, 2016 at 03:20:12PM +0100, Wei Liu wrote:
> > > In the latest libxenlight code, libxl_domain_create_restore accepts a
> > > new argument. Update libvirt's libxl driver for that. Use the macro
> > > provided by libxenlight to detect which version should be used.
> > > 
> > > The new parameter (send_back_fd) is set to -1 because libvirt provides
> > > no such fd.
> ...
> > > -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> > > +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> > > +        params.checkpointed_stream = 0;
> > > +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > > +                                          restore_fd, -1, &params, NULL,
> > > +                                          &aop_console_how);
> > > +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
> > >          params.checkpointed_stream = 0;
> > >          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > >                                            restore_fd, &params, NULL,
> 
> Another approach would be 
> 
>              ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
>                                                restore_fd,
>     #ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD
>                                                -1,
>     #endif
>     #ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
>                                                &params,
>     #endif
>                                                NULL, &aop_console_how);
> 
> But which to choose is a matter of taste.
> 

I merely followed the existing style. Let's keep it that way for now.

Wei.

> Ian.
Douglas Goldstein April 6, 2016, 9:43 p.m. UTC | #4
On 4/5/16 9:20 AM, Wei Liu wrote:
> In the latest libxenlight code, libxl_domain_create_restore accepts a
> new argument. Update libvirt's libxl driver for that. Use the macro
> provided by libxenlight to detect which version should be used.
> 
> The new parameter (send_back_fd) is set to -1 because libvirt provides
> no such fd.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Build test with Xen 4.6.1 (old API) and Xen unstable (new API).
> ---
>  src/libxl/libxl_domain.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> index 04962a0..aed904b 100644
> --- a/src/libxl/libxl_domain.c
> +++ b/src/libxl/libxl_domain.c
> @@ -1070,7 +1070,12 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>          ret = libxl_domain_create_new(cfg->ctx, &d_config,
>                                        &domid, NULL, &aop_console_how);
>      } else {
> -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> +        params.checkpointed_stream = 0;
> +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> +                                          restore_fd, -1, &params, NULL,
> +                                          &aop_console_how);
> +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
>          params.checkpointed_stream = 0;
>          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
>                                            restore_fd, &params, NULL,
> 

ACK

This fixes integration testing that Xen Project does with libvirt and
Xen so it would be nice to get in for 1.3.3.
Daniel P. Berrangé April 7, 2016, 4:35 p.m. UTC | #5
On Wed, Apr 06, 2016 at 04:43:07PM -0500, Doug Goldstein wrote:
> On 4/5/16 9:20 AM, Wei Liu wrote:
> > In the latest libxenlight code, libxl_domain_create_restore accepts a
> > new argument. Update libvirt's libxl driver for that. Use the macro
> > provided by libxenlight to detect which version should be used.
> > 
> > The new parameter (send_back_fd) is set to -1 because libvirt provides
> > no such fd.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > Build test with Xen 4.6.1 (old API) and Xen unstable (new API).
> > ---
> >  src/libxl/libxl_domain.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> > index 04962a0..aed904b 100644
> > --- a/src/libxl/libxl_domain.c
> > +++ b/src/libxl/libxl_domain.c
> > @@ -1070,7 +1070,12 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
> >          ret = libxl_domain_create_new(cfg->ctx, &d_config,
> >                                        &domid, NULL, &aop_console_how);
> >      } else {
> > -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> > +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> > +        params.checkpointed_stream = 0;
> > +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > +                                          restore_fd, -1, &params, NULL,
> > +                                          &aop_console_how);
> > +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
> >          params.checkpointed_stream = 0;
> >          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> >                                            restore_fd, &params, NULL,
> > 
> 
> ACK
> 
> This fixes integration testing that Xen Project does with libvirt and
> Xen so it would be nice to get in for 1.3.3.

It missed the boat for 1.3.3, but I've pushed it now



Regards,
Daniel
Wei Liu April 7, 2016, 5:44 p.m. UTC | #6
On Thu, Apr 07, 2016 at 05:35:33PM +0100, Daniel P. Berrange wrote:
> On Wed, Apr 06, 2016 at 04:43:07PM -0500, Doug Goldstein wrote:
> > On 4/5/16 9:20 AM, Wei Liu wrote:
> > > In the latest libxenlight code, libxl_domain_create_restore accepts a
> > > new argument. Update libvirt's libxl driver for that. Use the macro
> > > provided by libxenlight to detect which version should be used.
> > > 
> > > The new parameter (send_back_fd) is set to -1 because libvirt provides
> > > no such fd.
> > > 
> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > > ---
> > > Build test with Xen 4.6.1 (old API) and Xen unstable (new API).
> > > ---
> > >  src/libxl/libxl_domain.c | 7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> > > index 04962a0..aed904b 100644
> > > --- a/src/libxl/libxl_domain.c
> > > +++ b/src/libxl/libxl_domain.c
> > > @@ -1070,7 +1070,12 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
> > >          ret = libxl_domain_create_new(cfg->ctx, &d_config,
> > >                                        &domid, NULL, &aop_console_how);
> > >      } else {
> > > -#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
> > > +#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
> > > +        params.checkpointed_stream = 0;
> > > +        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > > +                                          restore_fd, -1, &params, NULL,
> > > +                                          &aop_console_how);
> > > +#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
> > >          params.checkpointed_stream = 0;
> > >          ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
> > >                                            restore_fd, &params, NULL,
> > > 
> > 
> > ACK
> > 
> > This fixes integration testing that Xen Project does with libvirt and
> > Xen so it would be nice to get in for 1.3.3.
> 
> It missed the boat for 1.3.3, but I've pushed it now
> 

Thank you very much for pushing this!

Wei.

> 
> 
> Regards,
> Daniel
> -- 
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
diff mbox

Patch

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 04962a0..aed904b 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1070,7 +1070,12 @@  libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
         ret = libxl_domain_create_new(cfg->ctx, &d_config,
                                       &domid, NULL, &aop_console_how);
     } else {
-#ifdef LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS
+#if defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_SEND_BACK_FD)
+        params.checkpointed_stream = 0;
+        ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
+                                          restore_fd, -1, &params, NULL,
+                                          &aop_console_how);
+#elif defined(LIBXL_HAVE_DOMAIN_CREATE_RESTORE_PARAMS)
         params.checkpointed_stream = 0;
         ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
                                           restore_fd, &params, NULL,