Ian Campbell
2010-Jul-23 07:35 UTC
[Xen-devel] [PATCH] libxl: do not create /vss and /xapi paths in xenstore
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1279816328 -3600 # Node ID b880a9fc98d14aad8464fb1a5c690f6b4bc14e03 # Parent d2f2da6ca3ed462db6f5040854c6cc50d571bfc4 libxl: do not create /vss and /xapi paths in xenstore. libxl doesn''t know anything about these paths and there is no reason it needs to manage them. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r d2f2da6ca3ed -r b880a9fc98d1 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Jul 22 17:17:00 2010 +0100 +++ b/tools/libxl/libxl.c Thu Jul 22 17:32:08 2010 +0100 @@ -88,7 +88,7 @@ int libxl_domain_make(struct libxl_ctx * char *rw_paths[] = { "device", "device/suspend/event-channel" , "data"}; char *ro_paths[] = { "cpu", "memory", "device", "error", "drivers", "control", "attr", "messages" }; - char *dom_path, *vm_path, *vss_path; + char *dom_path, *vm_path; struct xs_permissions roperm[2]; struct xs_permissions rwperm[1]; xs_transaction_t t; @@ -122,8 +122,7 @@ int libxl_domain_make(struct libxl_ctx * return ERROR_FAIL; vm_path = libxl_sprintf(ctx, "/vm/%s", uuid_string); - vss_path = libxl_sprintf(ctx, "/vss/%s", uuid_string); - if (!vm_path || !vss_path) { + if (!vm_path) { XL_LOG(ctx, XL_LOG_ERROR, "cannot allocate create paths"); return ERROR_FAIL; } @@ -145,12 +144,7 @@ retry_transaction: xs_mkdir(ctx->xsh, t, vm_path); xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm)); - xs_rm(ctx->xsh, t, vss_path); - xs_mkdir(ctx->xsh, t, vss_path); - xs_set_permissions(ctx->xsh, t, vss_path, rwperm, ARRAY_SIZE(rwperm)); - xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/vm", dom_path), vm_path, strlen(vm_path)); - xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/vss", dom_path), vss_path, strlen(vss_path)); rc = libxl_domain_rename(ctx, *domid, 0, info->name, t); if (rc) return rc; @@ -733,7 +727,7 @@ int libxl_domain_destroy(struct libxl_ct int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force) { char *dom_path; - char *vm_path, *vss_path, *xapi_path; + char *vm_path; int rc, dm_present; if (is_hvm(ctx, domid)) { @@ -773,18 +767,8 @@ int libxl_domain_destroy(struct libxl_ct if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); - vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/vss", dom_path)); - if (vss_path) - if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); - if (!xs_rm(ctx->xsh, XBT_NULL, dom_path)) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); - - xapi_path = libxl_sprintf(ctx, "/xapi/%u", domid); - if (xapi_path) - if (!xs_rm(ctx->xsh, XBT_NULL, xapi_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", xapi_path); libxl__userdata_destroyall(ctx, domid); diff -r d2f2da6ca3ed -r b880a9fc98d1 tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Jul 22 17:17:00 2010 +0100 +++ b/tools/libxl/libxl_device.c Thu Jul 22 17:32:08 2010 +0100 @@ -42,11 +42,10 @@ int libxl_device_generic_add(struct libx int libxl_device_generic_add(struct libxl_ctx *ctx, libxl_device *device, char **bents, char **fents) { - char *dom_path_backend, *dom_path, *frontend_path, *backend_path, *hotplug_path; + char *dom_path_backend, *dom_path, *frontend_path, *backend_path; xs_transaction_t t; struct xs_permissions frontend_perms[2]; struct xs_permissions backend_perms[2]; - struct xs_permissions hotplug_perms[1]; if (!is_valid_device_kind(device->backend_kind) || !is_valid_device_kind(device->kind)) return ERROR_INVAL; @@ -58,8 +57,6 @@ int libxl_device_generic_add(struct libx dom_path, string_of_kinds[device->kind], device->devid); backend_path = libxl_sprintf(ctx, "%s/backend/%s/%u/%d", dom_path_backend, string_of_kinds[device->backend_kind], device->domid, device->devid); - hotplug_path = libxl_sprintf(ctx, "/xapi/%d/hotplug/%s/%d", - device->domid, string_of_kinds[device->kind], device->devid); frontend_perms[0].id = device->domid; frontend_perms[0].perms = XS_PERM_NONE; @@ -70,9 +67,6 @@ int libxl_device_generic_add(struct libx backend_perms[0].perms = XS_PERM_NONE; backend_perms[1].id = device->domid; backend_perms[1].perms = XS_PERM_READ; - - hotplug_perms[0].id = device->backend_domid; - hotplug_perms[0].perms = XS_PERM_NONE; retry_transaction: t = xs_transaction_start(ctx->xsh); @@ -86,9 +80,6 @@ retry_transaction: xs_mkdir(ctx->xsh, t, backend_path); xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, ARRAY_SIZE(backend_perms)); - - xs_mkdir(ctx->xsh, t, hotplug_path); - xs_set_permissions(ctx->xsh, t, hotplug_path, hotplug_perms, ARRAY_SIZE(hotplug_perms)); xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/backend", frontend_path), backend_path, strlen(backend_path)); xs_write(ctx->xsh, t, libxl_sprintf(ctx, "%s/frontend", backend_path), frontend_path, strlen(frontend_path)); @@ -353,7 +344,7 @@ int libxl_devices_destroy(struct libxl_c int libxl_device_del(struct libxl_ctx *ctx, libxl_device *dev, int wait) { - char *dom_path_backend, *backend_path, *hotplug_path; + char *dom_path_backend, *backend_path; int rc; struct libxl_ctx clone; @@ -367,10 +358,6 @@ int libxl_device_del(struct libxl_ctx *c dom_path_backend, string_of_kinds[dev->backend_kind], dev->domid, dev->devid); - hotplug_path = libxl_sprintf(&clone, "/xapi/%d/hotplug/%s/%d", - dev->domid, - string_of_kinds[dev->kind], - dev->devid); libxl_free(&clone, dom_path_backend); rc = libxl_device_destroy(&clone, backend_path, !wait); @@ -386,7 +373,6 @@ int libxl_device_del(struct libxl_ctx *c (void)wait_for_dev_destroy(&clone, &tv); } - xs_rm(clone.xsh, XBT_NULL, hotplug_path); libxl_ctx_free(&clone); return 0; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2010-Jul-23 12:20 UTC
Re: [Xen-devel] [PATCH] libxl: do not create /vss and /xapi paths in xenstore
On Fri, 23 Jul 2010, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1279816328 -3600 > # Node ID b880a9fc98d14aad8464fb1a5c690f6b4bc14e03 > # Parent d2f2da6ca3ed462db6f5040854c6cc50d571bfc4 > libxl: do not create /vss and /xapi paths in xenstore. > > libxl doesn''t know anything about these paths and there is no reason it needs to > manage them. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel