All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xend: Fix removing /vm/UUID/device paths when device cannot be disconnected v2
@ 2009-03-12 14:24 Jiri Denemark
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Denemark @ 2009-03-12 14:24 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

Hi,

This is a corrected version of a patch commited as c/s 19250 and reverted by
c/s 19314. Thanks to "trap sigerr ERR" in xen-hotplug-common.sh the
xen-hotplug-cleanup would exit when reading /local/domain/ID/vm fails thus
skipping all the xenstore-rm lines in the rest of the script. Sorry for the
troubles the original patch caused...


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@redhat.com>

[-- Attachment #2: device_destroy.patch --]
[-- Type: text/plain, Size: 1837 bytes --]

diff -r 832f9e32832d tools/hotplug/Linux/xen-hotplug-cleanup
--- a/tools/hotplug/Linux/xen-hotplug-cleanup	Thu Mar 12 11:26:32 2009 +0000
+++ b/tools/hotplug/Linux/xen-hotplug-cleanup	Thu Mar 12 14:53:10 2009 +0100
@@ -11,6 +11,17 @@
 # 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_default "/local/domain/${path_array[2]}/vm" "")
+# construct /vm/UUID/device/DEVCLASS/DEVID
+if [ "$vm" != "" ]; then
+  vm_dev="$vm/device/${path_array[1]}/${path_array[3]}"
+else
+  vm_dev=
+fi
+
 # remove device frontend store entries
 xenstore-rm -t \
   $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true
@@ -19,4 +30,7 @@
 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
+[ "$vm_dev" != "" ] && xenstore-rm -t "$vm_dev" 2>/dev/null || true
+
 release_lock "block"
diff -r 832f9e32832d tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py	Thu Mar 12 11:26:32 2009 +0000
+++ b/tools/python/xen/xend/server/DevController.py	Thu Mar 12 14:53:10 2009 +0100
@@ -235,8 +235,8 @@
                 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))

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-13  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <49B9C000.3070805@intel.com>
2009-03-13  2:42 ` [PATCH] xend: Fix removing /vm/UUID/device paths when device cannot be disconnected v2 Yang, Xiaowei
2009-03-12 14:24 Jiri Denemark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.