/usr/lib/xcp/scripts/block 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 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/sh
TYPE=`echo ${XENBUS_PATH} | cut -f 2 -d '/'`
DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
HOTPLUG=/xapi/${DOMID}/hotplug/${TYPE}/${DEVID}
HOTPLUG_STATUS="${XENBUS_PATH}/hotplug-status"
syslog ()
{
logger -tscripts-block "$*"
}
case "$1" in
add)
params=$(xenstore-read "${XENBUS_PATH}/params")
frontend="/local/domain/${DOMID}/device/${TYPE}/${DEVID}"
syslog "${XENBUS_PATH}: add params=\"${params}\""
# We don't have PV drivers for CDROM devices, so we prevent blkback
# from opening the physical-device
xenstore-exists "${XENBUS_PATH}/no-physical-device"
if [ $? -ne 0 ]; then
physical_device=$(/usr/bin/stat --format="%t:%T" "${params}")
syslog "${XENBUS_PATH}: physical-device=${physical_device}"
xenstore-exists "${XENBUS_PATH}/physical-device"
if [ $? -eq 1 ]; then
syslog "${XENBUS_PATH}: writing physical-device=${physical-device}"
xenstore-write "${XENBUS_PATH}/physical-device" "${physical_device}"
fi
else
syslog "${XENBUS_PATH}: not writing physical-device because no-physical-device is present"
fi
xenstore-write "${HOTPLUG}/hotplug" "online"
xenstore-write "${HOTPLUG_STATUS}" "connected"
;;
change)
syslog "${XENBUS_PATH}: change"
;;
remove)
syslog "${XENBUS_PATH}: change"
xenstore-rm "${HOTPLUG_STATUS}"
xenstore-rm "${HOTPLUG}/hotplug"
;;
esac
|