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

Re: [Xen-devel] [PATCH] libxl: make libxl communicate with xenstored by socket or xenbus driver



On Thu, 2010-09-02 at 14:56 +0100, Jun Zhu (Intern) wrote:
> Hi,
> 
> George sent a patch on this problem before, but it was not completed. 
> This patch makes libxl use xenbus to communicate with xenstored if
> libxl cannot open a socket.

I think rather than repeating the pattern:
    xsh = xs_daemon_open();
    if (!xsh)
        xsh = xs_domain_open();
everywhere we should add libxl__xenstore_open() instead.

> There's a place that does not close fd in the case of failure, which
> is also fixed in this patch.

It's a small patch in this case but generally it is best to put separate
fixes in separate patches.

Also you need to add a Signed-off-by to your patches. I suspect the
maintainers would also appreciate it if you would format the email as
        DESCRIPTION

        Signed-off-by:

        PATCH

without additional punctuation or delineation (such as ---Patch----)
which they need to edit out when applying.

Ian.

> 
> -----------------------------------------Patch------------------------------------------------------
> diff -r eff592364826 tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c     Wed Sep 01 11:23:49 2010 +0100
> +++ b/tools/libxl/libxl.c     Thu Sep 02 14:51:46 2010 +0100
> @@ -1387,10 +1387,8 @@
>  {
>      libxl_device_model_starting *starting = for_spawn;
>      char *kvs[3];
> -    int rc;
>      struct xs_handle *xsh;
>  
> -    xsh = xs_daemon_open();
>      /* we mustn't use the parent's handle in the child */
>  
>      kvs[0] = "image/device-model-pid";
> @@ -1398,9 +1396,10 @@
>          return;
>      kvs[2] = NULL;
>  
> -    rc = xs_writev(xsh, XBT_NULL, starting->dom_path, kvs);
> -    if (rc)
> -        return;
> +    xsh = xs_daemon_open();
> +    if (!xsh)
> +        xsh = xs_domain_open();
> +    xs_writev(xsh, XBT_NULL, starting->dom_path, kvs);
>      xs_daemon_close(xsh);
>  }
>  
> diff -r eff592364826 tools/libxl/libxl_device.c
> --- a/tools/libxl/libxl_device.c      Wed Sep 01 11:23:49 2010 +0100
> +++ b/tools/libxl/libxl_device.c      Thu Sep 02 14:51:46 2010 +0100
> @@ -406,6 +406,8 @@
>      char **l = NULL;
>  
>      xsh = xs_daemon_open();
> +    if (!xsh)
> +        xsh = xs_domain_open();
>      path = libxl_sprintf(&gc, "/local/domain/0/device-model/%d/state", 
> domid);
>      xs_watch(xsh, path, path);
>      tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
> diff -r eff592364826 tools/libxl/libxl_dom.c
> --- a/tools/libxl/libxl_dom.c Wed Sep 01 11:23:49 2010 +0100
> +++ b/tools/libxl/libxl_dom.c Thu Sep 02 14:51:46 2010 +0100
> @@ -284,6 +284,8 @@
>      snprintf(path, sizeof(path), 
> "/local/domain/0/device-model/%u/logdirty/cmd", domid);
>  
>      xsh = xs_daemon_open();
> +    if (!xsh)
> +        xsh = xs_domain_open();
>  
>      if (enable)
>          xs_write(xsh, XBT_NULL, path, "enable", strlen("enable"));
> diff -r eff592364826 tools/libxl/libxl_utils.c
> --- a/tools/libxl/libxl_utils.c       Wed Sep 01 11:23:49 2010 +0100
> +++ b/tools/libxl/libxl_utils.c       Thu Sep 02 14:51:46 2010 +0100
> @@ -368,6 +368,8 @@
>  int libxl_ctx_postfork(libxl_ctx *ctx) {
>      if (ctx->xsh) xs_daemon_destroy_postfork(ctx->xsh);
>      ctx->xsh = xs_daemon_open();
> +    if (!ctx->xsh)
> +        ctx->xsh = xs_domain_open();
>      if (!ctx->xsh) return ERROR_FAIL;
>      return 0;
>  }
> --------------------------------------END----------------------------------------------
> 
> 
> Jun Zhu
> Citrix Systems UK
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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