Skip to content

Commit 139afe9

Browse files
author
Jon Ludlam
committed
Udev jiggery-pokery
Add in the udev scripts from xen-api.git. Note these are only installed in the xen-api-libs-specs specfile, not in the xenserver-core specfile. Signed-off-by: Jon Ludlam <[email protected]>
1 parent 04bc7b1 commit 139afe9

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

scripts/block

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
3+
TYPE=`echo ${XENBUS_PATH} | cut -f 2 -d '/'`
4+
DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
5+
DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
6+
7+
HOTPLUG=/xapi/${DOMID}/hotplug/${TYPE}/${DEVID}
8+
HOTPLUG_STATUS="${XENBUS_PATH}/hotplug-status"
9+
10+
syslog ()
11+
{
12+
logger -tscripts-block "$*"
13+
}
14+
15+
case "$1" in
16+
add)
17+
params=$(xenstore-read "${XENBUS_PATH}/params")
18+
frontend="/local/domain/${DOMID}/device/${TYPE}/${DEVID}"
19+
syslog "${XENBUS_PATH}: add params=\"${params}\""
20+
# We don't have PV drivers for CDROM devices, so we prevent blkback
21+
# from opening the physical-device
22+
xenstore-exists "${XENBUS_PATH}/no-physical-device"
23+
if [ $? -ne 0 ]; then
24+
physical_device=$(/usr/bin/stat --format="%t:%T" "${params}")
25+
syslog "${XENBUS_PATH}: physical-device=${physical_device}"
26+
xenstore-exists "${XENBUS_PATH}/physical-device"
27+
if [ $? -eq 1 ]; then
28+
syslog "${XENBUS_PATH}: writing physical-device=${physical-device}"
29+
xenstore-write "${XENBUS_PATH}/physical-device" "${physical_device}"
30+
fi
31+
else
32+
syslog "${XENBUS_PATH}: not writing physical-device because no-physical-device is present"
33+
fi
34+
xenstore-write "${HOTPLUG}/hotplug" "online"
35+
xenstore-write "${HOTPLUG_STATUS}" "connected"
36+
;;
37+
change)
38+
syslog "${XENBUS_PATH}: change"
39+
;;
40+
remove)
41+
syslog "${XENBUS_PATH}: remove"
42+
xenstore-rm "${HOTPLUG_STATUS}"
43+
xenstore-rm "${HOTPLUG}/hotplug"
44+
;;
45+
esac

scripts/tap

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
TYPE=`echo ${XENBUS_PATH} | cut -f 2 -d '/'`
4+
DOMID=`echo ${XENBUS_PATH} | cut -f 3 -d '/'`
5+
DEVID=`echo ${XENBUS_PATH} | cut -f 4 -d '/'`
6+
7+
XAPI=/xapi/${DOMID}/hotplug/${TYPE}/${DEVID}
8+
9+
syslog ()
10+
{
11+
BLKTAP=daemon
12+
logger -p$BLKTAP.info -tscripts-tap "$*"
13+
}
14+
15+
case "$1" in
16+
add)
17+
syslog "$XAPI: hotplug deferred to backend change"
18+
;;
19+
change)
20+
syslog "$XAPI: backend changed"
21+
xenstore-write "${XAPI}/hotplug" "online"
22+
;;
23+
remove)
24+
syslog "$XAPI: backend removed"
25+
xenstore-rm "${XAPI}/hotplug"
26+
;;
27+
esac

scripts/xen-backend.rules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/usr/libexec/xenopsd/tap $env{ACTION}"
2+
SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/usr/libexec/xenopsd/block $env{ACTION}"
3+
4+
SUBSYSTEM=="xen-backend", KERNEL=="vif*", RUN+="/usr/libexec/xenopsd/vif $env{ACTION} type_if=vif"
5+
SUBSYSTEM=="net", KERNEL=="tap*", RUN+="/usr/libexec/xenopsd/vif $env{ACTION} type_if=tap"
6+
7+
KERNEL=="evtchn", NAME="xen/%k"

0 commit comments

Comments
 (0)