aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2012-07-26 10:35:32 +0100
committerRoger Pau Monne <roger.pau@citrix.com>2012-07-26 10:35:32 +0100
commit784528b67d0f7bfb2485f53b4424dd6d2ac72d51 (patch)
treecd3c29a1967c2a1e4a2ecd0f273109750cbdb333
parent2621f73e49c1b91c1064c8b7d5738fe3e36cdc56 (diff)
downloadxen-784528b67d0f7bfb2485f53b4424dd6d2ac72d51.tar.gz
xen-784528b67d0f7bfb2485f53b4424dd6d2ac72d51.tar.bz2
xen-784528b67d0f7bfb2485f53b4424dd6d2ac72d51.zip
libxl: use libxl__xs_path_cleanup on device_destroy
Since the hotplug script that was in charge of cleaning the backend is no longer launched, we need to clean the backend by ourselves, so use libxl__xs_path_cleanup instead of xs_rm. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
-rw-r--r--tools/libxl/libxl_device.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index a94beabf08..a1b60d7a4f 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -447,16 +447,26 @@ void libxl__ao_devices_callback(libxl__egc *egc, libxl__ao_device *aodev)
int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
{
- libxl_ctx *ctx = libxl__gc_owner(gc);
char *be_path = libxl__device_backend_path(gc, dev);
char *fe_path = libxl__device_frontend_path(gc, dev);
+ xs_transaction_t t = 0;
+ int rc = 0;
- xs_rm(ctx->xsh, XBT_NULL, be_path);
- xs_rm(ctx->xsh, XBT_NULL, fe_path);
+ do {
+ t = xs_transaction_start(CTX->xsh);
+ libxl__xs_path_cleanup(gc, t, fe_path);
+ libxl__xs_path_cleanup(gc, t, be_path);
+ rc = !xs_transaction_end(CTX->xsh, t, 0);
+ } while (rc && errno == EAGAIN);
+ if (rc) {
+ LOGE(ERROR, "unable to finish transaction");
+ goto out;
+ }
libxl__device_destroy_tapdisk(gc, be_path);
- return 0;
+out:
+ return rc;
}
/* Callback for device destruction */