[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: Fix removing /vm/UUID/device paths when device cannot be disconnected



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1235990077 0
# Node ID b3774712e654ab669198630e34d7b14dd80aa125
# Parent  16fc70ce40a73c191427487845449715849a2809
xend: Fix removing /vm/UUID/device paths when device cannot be disconnected

Change deviceDestroy behavior to remove /vm/UUID/device/...
path only when force was used (as it already does so for both frontend
and backend) and do the removing from xen-hotplug-cleanup script when we
are sure the device is really not attached to the guest any more.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 tools/hotplug/Linux/xen-hotplug-cleanup       |   10 ++++++++++
 tools/python/xen/xend/server/DevController.py |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff -r 16fc70ce40a7 -r b3774712e654 tools/hotplug/Linux/xen-hotplug-cleanup
--- a/tools/hotplug/Linux/xen-hotplug-cleanup   Mon Mar 02 10:32:32 2009 +0000
+++ b/tools/hotplug/Linux/xen-hotplug-cleanup   Mon Mar 02 10:34:37 2009 +0000
@@ -11,6 +11,13 @@ dir=$(dirname "$0")
 # This is pretty horrible, but there's not really a nicer way of solving this.
 claim_lock "block"
 
+# split backend/DEVCLASS/VMID/DEVID on slashes
+path_array=( ${XENBUS_PATH//\// } )
+# get /vm/UUID path
+vm=$(xenstore-read "/local/domain/${path_array[2]}/vm")
+# construct /vm/UUID/device/DEVCLASS/DEVID
+vm_dev="$vm/device/${path_array[1]}/${path_array[3]}"
+
 # remove device frontend store entries
 xenstore-rm -t \
   $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true
@@ -19,4 +26,7 @@ xenstore-rm -t "$XENBUS_PATH"        2>/
 xenstore-rm -t "$XENBUS_PATH"        2>/dev/null || true
 xenstore-rm -t "error/$XENBUS_PATH"  2>/dev/null || true
 
+# remove device path from /vm/UUID
+xenstore-rm -t "$vm_dev" 2>/dev/null || true
+
 release_lock "block"
diff -r 16fc70ce40a7 -r b3774712e654 
tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py     Mon Mar 02 10:32:32 
2009 +0000
+++ b/tools/python/xen/xend/server/DevController.py     Mon Mar 02 10:34:37 
2009 +0000
@@ -235,8 +235,8 @@ class DevController:
                 xstransact.Remove(backpath)
             xstransact.Remove(frontpath)
 
-        # xstransact.Remove(self.devicePath()) ?? Below is the same ?
-        self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
+            # xstransact.Remove(self.devicePath()) ?? Below is the same ?
+            self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
 
     def configurations(self, transaction = None):
         return map(lambda x: self.configuration(x, transaction), 
self.deviceIDs(transaction))

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.