[PATCH 5/5] libxl: clean xenstore console directories recursively on destroy

Roger Pau Monne
Mon, 16 Apr 2012 15:06:44 -0000

Clean xenstore, to prevent leaving empty directories in the tree, like:

/local/domain/0/backend/console = ""   (n0)
/local/domain/0/backend/console/3 = ""   (n0)

That was left after a guest was destroyed.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
 tools/libxl/libxl_device.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index d773d71..4161d1bd 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -609,12 +609,11 @@ out_ok:

 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_rm(ctx->xsh, XBT_NULL, be_path);
-    xs_rm(ctx->xsh, XBT_NULL, fe_path);
+    libxl__xs_path_cleanup(gc, fe_path);
+    libxl__xs_path_cleanup(gc, be_path);

     libxl__device_destroy_tapdisk(gc, be_path);

--
1.7.7.5 (Apple Git-26)