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 the entries from xenstore w

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: remove the entries from xenstore when destroying a disk
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 18 Feb 2011 01:50:21 -0800
Delivery-date: Fri, 18 Feb 2011 01:51:21 -0800
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 Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1297972244 0
# Node ID 54b0749d9f4655508b1679de4bb2841c8a1aa512
# Parent  fd61708757180a05a4690764732e7be55bcc6772
libxl: remove the entries from xenstore when destroying a disk

Currently we are only changing the backend state but it is not enough to
entirely destroying a disk device: remove all the entries from xenstore
as well.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c          |    9 +++++++--
 tools/libxl/libxl_device.c   |    4 ++--
 tools/libxl/libxl_internal.h |    2 ++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff -r fd6170875718 -r 54b0749d9f46 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Feb 17 19:49:57 2011 +0000
+++ b/tools/libxl/libxl.c       Thu Feb 17 19:50:44 2011 +0000
@@ -1038,8 +1038,9 @@ int libxl_device_disk_del(libxl_ctx *ctx
 int libxl_device_disk_del(libxl_ctx *ctx, 
                           libxl_device_disk *disk, int wait)
 {
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl__device device;
-    int devid;
+    int devid, rc;
 
     devid = libxl__device_disk_dev_number(disk->vdev);
     device.backend_domid    = disk->backend_domid;
@@ -1049,7 +1050,11 @@ int libxl_device_disk_del(libxl_ctx *ctx
     device.domid            = disk->domid;
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
-    return libxl__device_del(ctx, &device, wait);
+    rc = libxl__device_del(ctx, &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));
+    libxl__free_all(&gc);
+    return rc;
 }
 
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
diff -r fd6170875718 -r 54b0749d9f46 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Thu Feb 17 19:49:57 2011 +0000
+++ b/tools/libxl/libxl_device.c        Thu Feb 17 19:50:44 2011 +0000
@@ -40,7 +40,7 @@ static const char *string_of_kinds[] = {
     [DEVICE_CONSOLE] = "console",
 };
 
-static char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device)
+char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device)
 {
     char *dom_path = libxl__xs_get_dompath(gc, device->domid);
 
@@ -52,7 +52,7 @@ static char *libxl__device_frontend_path
                           string_of_kinds[device->kind], device->devid);
 }
 
-static char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device)
+char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device)
 {
     char *dom_path = libxl__xs_get_dompath(gc, device->backend_domid);
 
diff -r fd6170875718 -r 54b0749d9f46 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Feb 17 19:49:57 2011 +0000
+++ b/tools/libxl/libxl_internal.h      Thu Feb 17 19:50:44 2011 +0000
@@ -186,6 +186,8 @@ _hidden int libxl__device_disk_dev_numbe
 
 _hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
                              char **bents, char **fents);
+_hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
+_hidden char *libxl__device_frontend_path(libxl__gc *gc, libxl__device 
*device);
 _hidden int libxl__device_del(libxl_ctx *ctx, libxl__device *dev, int wait);
 _hidden int libxl__device_destroy(libxl_ctx *ctx, char *be_path, int force);
 _hidden int libxl__devices_destroy(libxl_ctx *ctx, uint32_t domid, int force);

_______________________________________________
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 the entries from xenstore when destroying a disk, Xen patchbot-unstable <=