/usr/lib/xcp/scripts/block-frontend is in xcp-xapi 1.3.2-5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/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 6 -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 ${DEVPATH} | cut -f 3 -d '/' | cut -f 1 -d '-'`
DEVID=`echo ${DEVPATH} | cut -f 3 -d '/' | cut -f 2 -d '-'`
XAPI=/xapi/${DOMID}/frontend/${TYPE}/${DEVID}
case "$1" in
add)
xenstore-write "${XAPI}/hotplug" "online"
;;
remove)
xenstore-rm "${XAPI}"
;;
esac
|