aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Marczykowski <marmarek@mimuw.edu.pl>2011-06-05 16:45:59 +0200
committerMarek Marczykowski <marmarek@mimuw.edu.pl>2011-06-05 16:45:59 +0200
commit8157f145d68cdf8743e99976f65b42e7df1027fe (patch)
treeeec00e6fbbc635714beff7e091611fa7b6d264c9
parent2ed867a1e663168e3f1723d58477be29c7b9e0a9 (diff)
downloadxen-8157f145d68cdf8743e99976f65b42e7df1027fe.tar.gz
xen-8157f145d68cdf8743e99976f65b42e7df1027fe.tar.bz2
xen-8157f145d68cdf8743e99976f65b42e7df1027fe.zip
libxl: Remove frontend and backend devices from xenstore after destroy
Cleanup frontend and backend devices from xenstore for all dev types - not only disks. Because backend cleanup moved to libxl__device_destroy, libxl__devices_destroy is somehow simpler. Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl> xen-unstable changest: 23605:ff8d170852b3 Backport-requested-by: Marek Marczykowski <marmarek@mimuw.edu.pl> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
-rw-r--r--tools/libxl/libxl_device.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 01d15650d4..c115014a99 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -269,7 +269,9 @@ retry_transaction:
if (!force) {
xs_watch(ctx->xsh, state_path, be_path);
rc = 1;
- }
+ } else {
+ xs_rm(ctx->xsh, XBT_NULL, be_path);
+ }
out:
libxl__free_all(&gc);
return rc;
@@ -310,10 +312,8 @@ int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
char *path, *be_path, *fe_path;
unsigned int num1, num2;
char **l1 = NULL, **l2 = NULL;
- int i, j, n = 0, n_watches = 0;
- flexarray_t *toremove;
+ int i, j, n_watches = 0;
- toremove = flexarray_make(16, 1);
path = libxl__sprintf(&gc, "/local/domain/%d/device", domid);
l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1);
if (!l1) {
@@ -337,7 +337,6 @@ int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
if (be_path != NULL) {
if (libxl__device_destroy(ctx, be_path, force) > 0)
n_watches++;
- flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
} else {
xs_rm(ctx->xsh, XBT_NULL, path);
}
@@ -350,7 +349,6 @@ int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
if (be_path && strcmp(be_path, "")) {
if (libxl__device_destroy(ctx, be_path, force) > 0)
n_watches++;
- flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
}
if (!force) {
@@ -370,12 +368,7 @@ int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force)
}
}
}
- for (i = 0; i < n; i++) {
- flexarray_get(toremove, i, (void**) &path);
- xs_rm(ctx->xsh, XBT_NULL, path);
- }
out:
- flexarray_free(toremove);
libxl__free_all(&gc);
return 0;
}
@@ -401,6 +394,7 @@ int libxl__device_del(libxl_ctx *ctx, libxl__device *dev, int wait)
(void)wait_for_dev_destroy(ctx, &tv);
}
+ xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(&gc, dev));
rc = 0;
out: