diff options
Diffstat (limited to 'tools/hotplug')
-rw-r--r-- | tools/hotplug/Linux/vif-bridge | 2 | ||||
-rw-r--r-- | tools/hotplug/Linux/vif-nat | 2 | ||||
-rw-r--r-- | tools/hotplug/Linux/vif-post.d/00-vif-local.hook | 18 | ||||
-rw-r--r-- | tools/hotplug/Linux/vif-route | 2 | ||||
-rw-r--r-- | tools/hotplug/Linux/xen-hotplug-common.sh | 11 |
5 files changed, 35 insertions, 0 deletions
diff --git a/tools/hotplug/Linux/vif-bridge b/tools/hotplug/Linux/vif-bridge index 1498805379..f48951935a 100644 --- a/tools/hotplug/Linux/vif-bridge +++ b/tools/hotplug/Linux/vif-bridge @@ -105,6 +105,8 @@ if [ "$type_if" = vif ]; then handle_iptable fi +call_hooks vif post + log debug "Successful vif-bridge $command for $dev, bridge $bridge." if [ "$type_if" = vif -a "$command" = "online" ] then diff --git a/tools/hotplug/Linux/vif-nat b/tools/hotplug/Linux/vif-nat index 9082cc96bb..8d29fb6ea2 100644 --- a/tools/hotplug/Linux/vif-nat +++ b/tools/hotplug/Linux/vif-nat @@ -185,6 +185,8 @@ esac handle_iptable +call_hooks vif post + log debug "Successful vif-nat $command for ${dev}." if [ "$command" = "online" ] then diff --git a/tools/hotplug/Linux/vif-post.d/00-vif-local.hook b/tools/hotplug/Linux/vif-post.d/00-vif-local.hook new file mode 100644 index 0000000000..d7d44535e2 --- /dev/null +++ b/tools/hotplug/Linux/vif-post.d/00-vif-local.hook @@ -0,0 +1,18 @@ +#============================================================================ +# ${XEN_SCRIPT_DIR}/vif-post.d/00-vif-local.hook +# +# Script for performing local configuration of a vif. +# This script will be sourced by, e.g., vif-bridge after the hotplugging +# system calls vif-bridge. The script is here and not simply executed as +# a udev rule because this allows simple access to several environment +# variables set by the calling vif-* script. +# +# Environment vars: +# command (add|remove|online|offline) +# dev vif interface name (required). +# main_ip IP address of Dom0 +# ip list of IP networks for the vif, space-separated +# XENBUS_PATH path to this device's details in the XenStore (required). +#============================================================================ + +# Place local modifications here. diff --git a/tools/hotplug/Linux/vif-route b/tools/hotplug/Linux/vif-route index 6c5587afd5..02f1403a54 100644 --- a/tools/hotplug/Linux/vif-route +++ b/tools/hotplug/Linux/vif-route @@ -49,6 +49,8 @@ fi handle_iptable +call_hooks vif post + log debug "Successful vif-route ${command} for ${dev}." if [ "${command}" = "online" ] then diff --git a/tools/hotplug/Linux/xen-hotplug-common.sh b/tools/hotplug/Linux/xen-hotplug-common.sh index 370f9ade2f..95beab0ec5 100644 --- a/tools/hotplug/Linux/xen-hotplug-common.sh +++ b/tools/hotplug/Linux/xen-hotplug-common.sh @@ -99,4 +99,15 @@ xenstore_write() { _xenstore_write "$@" || fatal "Writing $@ to xenstore failed." } +## +# call_hooks <devtype> <hook> +# +# Execute each hook in the <hook> directory. +# +call_hooks() { + for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do + [ -x "$f" ] && . "$f" + done +} + log debug "$@" "XENBUS_PATH=$XENBUS_PATH" |