libxl: do not create /vss and /xapi paths in xenstore.
authorIan Campbell <ian.campbell@citrix.com>
Fri, 23 Jul 2010 16:35:59 +0000 (17:35 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 23 Jul 2010 16:35:59 +0000 (17:35 +0100)
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>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_device.c

index de87c1d03aa7dac247b7bdff253f0e1e9f9c065c..eb59ce29d79b50f229ac57165808a7267edcc93e 100644 (file)
@@ -87,7 +87,7 @@ int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info,
     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;
@@ -121,8 +121,7 @@ int libxl_domain_make(struct libxl_ctx *ctx, libxl_domain_create_info *info,
         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;
     }
@@ -144,12 +143,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;
 
@@ -787,7 +781,7 @@ static int libxl_destroy_device_model(struct libxl_ctx *ctx, uint32_t domid)
 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)) {
@@ -826,19 +820,9 @@ int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force)
         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);
 
     rc = xc_domain_destroy(ctx->xch, domid);
index 677b4c80583142c91201fb395b599bc63dbfd9be..194134e29997fadd44e6d8e07f9db82d142aa7b7 100644 (file)
@@ -42,11 +42,10 @@ static const char *string_of_kinds[] = {
 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 libxl_ctx *ctx, libxl_device *device,
                                   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;
@@ -71,9 +68,6 @@ int libxl_device_generic_add(struct libxl_ctx *ctx, libxl_device *device,
     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);
     /* FIXME: read frontend_path and check state before removing stuff */
@@ -87,9 +81,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_ctx *ctx, uint32_t domid, int force)
 
 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 *ctx, libxl_device *dev, int wait)
                                     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 *ctx, libxl_device *dev, int wait)
         (void)wait_for_dev_destroy(&clone, &tv);
     }
 
-    xs_rm(clone.xsh, XBT_NULL, hotplug_path);
     libxl_ctx_free(&clone);
     return 0;
 }