Files
xen/tools/hotplug/Linux/xen-hotplug-cleanup
T
Keir Fraser a2b4af7d77 Get rid of hardcoded pathes for stubdom and hotplug scripts
- Have the buid system generate a file which exports the install paths
   for the hotplug scripts and stubdom / stubdom-dm
- Move file generation code from tools/python/Makefile into a gmake
   macro
  in Config.mk to avoid maintenance of three duplicates each with its
   own
  tweaks and bugs
- Export gmake variables into ioemu as shell variables
  for upcoming ioemu patches
- Do above as a gmake macro to avoid maintenance of several duplicates
- Adjust hotplug scripts to find the right xen binaries from the
  install directory
- Adjust stubdom-dm to use the install directories

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-06-23 17:25:51 +01:00

37 lines
1.2 KiB
Bash

#! /bin/bash
dir=$(dirname "$0")
. "$dir/xen-hotplug-common.sh"
# Claim the lock protecting ${XEN_SCRIPT_DIR}/block. This stops a race whereby
# paths in the store would disappear underneath that script as it attempted to
# read from the store checking for device sharing.
# Any other scripts that do similar things will have to have their lock
# claimed too.
# 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
# remove device backend store entries
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"