[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] libxl: make libxl communicate with xenstored by socket or xenbus driver
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. There's a place that does not close fd in the case of failure, which is also fixed in this patch. -----------------------------------------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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |