xen-vtx-unstable

view tools/examples/xen-backend.agent @ 6742:e9d01c5dc7b4

Move block device bind/unbind into hotplug scripts.
Fixes file: devices since unbind now runs after the backend driver
closes the loopback device.
Also moves name -> node translation into the backend domain.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Sep 12 19:49:03 2005 +0000 (2005-09-12)
parents 291e816acbf4
children 219d96d545fc
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