WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: Remove frontend and backend device

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: Remove frontend and backend devices from xenstore after destroy
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 28 Jun 2011 07:44:33 +0100
Delivery-date: Mon, 27 Jun 2011 23:51:41 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1309192132 -3600
# Node ID ff8d170852b3ebcd6301547fb296073ee24de344
# Parent  5d7998be22520ca9b1c0c3e6f881ca834deda299
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@xxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 5d7998be2252 -r ff8d170852b3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Jun 27 17:27:08 2011 +0100
+++ b/tools/libxl/libxl.c       Mon Jun 27 17:28:52 2011 +0100
@@ -1113,8 +1113,6 @@
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
     rc = libxl__device_del(&gc, &device, wait);
-    xs_rm(ctx->xsh, XBT_NULL, libxl__device_backend_path(&gc, &device));
-    xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(&gc, &device));
 out_free:
     libxl__free_all(&gc);
     return rc;
diff -r 5d7998be2252 -r ff8d170852b3 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Mon Jun 27 17:27:08 2011 +0100
+++ b/tools/libxl/libxl_device.c        Mon Jun 27 17:28:52 2011 +0100
@@ -273,6 +273,8 @@
     if (!force) {
         xs_watch(ctx->xsh, state_path, be_path);
         rc = 1;
+    } else {
+        xs_rm(ctx->xsh, XBT_NULL, be_path);
     }
 out:
     return rc;
@@ -312,10 +314,8 @@
     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) {
@@ -339,7 +339,6 @@
             if (be_path != NULL) {
                 if (libxl__device_destroy(gc, be_path, force) > 0)
                     n_watches++;
-                flexarray_set(toremove, n++, libxl__dirname(gc, be_path));
             } else {
                 xs_rm(ctx->xsh, XBT_NULL, path);
             }
@@ -352,7 +351,6 @@
     if (be_path && strcmp(be_path, "")) {
         if (libxl__device_destroy(gc, be_path, force) > 0)
             n_watches++;
-        flexarray_set(toremove, n++, libxl__dirname(gc, be_path));
     }
 
     if (!force) {
@@ -372,17 +370,13 @@
             }
         }
     }
-    for (i = 0; i < n; i++) {
-        flexarray_get(toremove, i, (void**) &path);
-        xs_rm(ctx->xsh, XBT_NULL, path);
-    }
 out:
-    flexarray_free(toremove);
     return 0;
 }
 
 int libxl__device_del(libxl__gc *gc, libxl__device *dev, int wait)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *backend_path;
     int rc;
 
@@ -401,6 +395,7 @@
         (void)wait_for_dev_destroy(gc, &tv);
     }
 
+    xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
     rc = 0;
 
 out:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: Remove frontend and backend devices from xenstore after destroy, Xen patchbot-unstable <=