WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxl: make libxl communicate with xenstored by

To: "Jun Zhu (Intern)" <Jun.Zhu@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: make libxl communicate with xenstored by socket or xenbus driver
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Thu, 2 Sep 2010 15:59:24 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 02 Sep 2010 08:01:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB57@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <433DDF91DFB08148BAD3FDB6FDDA314C9F35F3BB57@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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