ia64/xen-unstable

view tools/examples/xen-backend.agent @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents bdc77b74bf61
children 06d84bf87159
line source
1 #! /bin/sh
3 #ACTION=add
4 #DEVPATH=/devices/xen-backend/vif-1-0
5 #PHYSDEVDRIVER=vif
6 #XENBUS_TYPE=vif
8 PATH=/etc/xen/scripts:$PATH
10 case "$ACTION" in
11 add)
12 case "$XENBUS_TYPE" in
13 vbd)
14 t=$(xenstore-read "$XENBUS_PATH"/type)
15 params=$(xenstore-read "$XENBUS_PATH"/params)
16 [ -x /etc/xen/scripts/block-"$t" ] && \
17 /etc/xen/scripts/block-"$t" bind $params
18 ;;
19 esac
20 ;;
21 remove)
22 case "$XENBUS_TYPE" in
23 vbd)
24 t=$(xenstore-read "$XENBUS_PATH"/type)
25 node=$(xenstore-read "$XENBUS_PATH"/node)
26 [ -x /etc/xen/scripts/block-"$t" ] && \
27 /etc/xen/scripts/block-"$t" unbind $node
28 ;;
29 esac
30 # remove device backend store entries
31 xenstore-rm "$XENBUS_PATH"
32 ;;
33 online)
34 case "$PHYSDEVDRIVER" in
35 vif)
36 [ -n "$script" ] && $script up
37 ;;
38 esac
39 ;;
40 offline)
41 ;;
42 esac