Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 35 lines (27 sloc) 0.996 kb
#!/bin/sh
# Writes to the store when this domain's frontend block device appears.
# Once this happens we should be safe opening the device.
# NB special handling of partition events:
# If we block-attach a device and then create partitions, events are
# generated with DEVPATHs of the form /block/xvde/xvde1 -- we ignore these
# If we block-attach a partition directly then events are generated
# with DEVPATHs of the form /block/xvde1 -- we act on these.
PARTITION=`echo ${DEVPATH} | cut -f 4 -d '/'`
if [ ! -z ${PARTITION} ]; then
# the bad kind of partition
exit
fi
DOMID=`xenstore-read domid`
# Extract the device type and ID from the PHYSDEVPATH eg
# PHYSDEVPATH=/devices/xen/vbd-51728
TYPE=`echo ${PHYSDEVPATH} | cut -f 4 -d '/' | cut -f 1 -d '-'`
DEVID=`echo ${PHYSDEVPATH} | cut -f 2 -d '-'`
XAPI=/xapi/${DOMID}/frontend/${TYPE}/${DEVID}
case "$1" in
add)
xenstore-write "${XAPI}/hotplug" "online"
;;
remove)
xenstore-rm "${XAPI}"
;;
esac
Jump to Line
Something went wrong with that request. Please try again.