ia64/xen-unstable

changeset 19252:b3774712e654

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@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 02 10:34:37 2009 +0000 (2009-03-02)
parents 16fc70ce40a7
children 9c4a38f70b16
files tools/hotplug/Linux/xen-hotplug-cleanup tools/python/xen/xend/server/DevController.py
line diff
     1.1 --- a/tools/hotplug/Linux/xen-hotplug-cleanup	Mon Mar 02 10:32:32 2009 +0000
     1.2 +++ b/tools/hotplug/Linux/xen-hotplug-cleanup	Mon Mar 02 10:34:37 2009 +0000
     1.3 @@ -11,6 +11,13 @@ dir=$(dirname "$0")
     1.4  # This is pretty horrible, but there's not really a nicer way of solving this.
     1.5  claim_lock "block"
     1.6  
     1.7 +# split backend/DEVCLASS/VMID/DEVID on slashes
     1.8 +path_array=( ${XENBUS_PATH//\// } )
     1.9 +# get /vm/UUID path
    1.10 +vm=$(xenstore-read "/local/domain/${path_array[2]}/vm")
    1.11 +# construct /vm/UUID/device/DEVCLASS/DEVID
    1.12 +vm_dev="$vm/device/${path_array[1]}/${path_array[3]}"
    1.13 +
    1.14  # remove device frontend store entries
    1.15  xenstore-rm -t \
    1.16    $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true
    1.17 @@ -19,4 +26,7 @@ xenstore-rm -t \
    1.18  xenstore-rm -t "$XENBUS_PATH"        2>/dev/null || true
    1.19  xenstore-rm -t "error/$XENBUS_PATH"  2>/dev/null || true
    1.20  
    1.21 +# remove device path from /vm/UUID
    1.22 +xenstore-rm -t "$vm_dev" 2>/dev/null || true
    1.23 +
    1.24  release_lock "block"
     2.1 --- a/tools/python/xen/xend/server/DevController.py	Mon Mar 02 10:32:32 2009 +0000
     2.2 +++ b/tools/python/xen/xend/server/DevController.py	Mon Mar 02 10:34:37 2009 +0000
     2.3 @@ -235,8 +235,8 @@ class DevController:
     2.4                  xstransact.Remove(backpath)
     2.5              xstransact.Remove(frontpath)
     2.6  
     2.7 -        # xstransact.Remove(self.devicePath()) ?? Below is the same ?
     2.8 -        self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
     2.9 +            # xstransact.Remove(self.devicePath()) ?? Below is the same ?
    2.10 +            self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev))
    2.11  
    2.12      def configurations(self, transaction = None):
    2.13          return map(lambda x: self.configuration(x, transaction), self.deviceIDs(transaction))