[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/hotplug: support vif-post.d hook arrangements



# HG changeset patch
# User W. Michael Petullo <mike@xxxxxxxx>
# Date 1306316724 -3600
# Node ID a44b12ee2fd37a66a616a1b93a6aa2f8bbb25f90
# Parent  6d4b7530cee105a4f0f35c6d90ff9a5ede4f59e0
tools/hotplug: support vif-post.d hook arrangements

New feature: you can drop hook scripts into
 /etc/xen/scripts/vif-post.d/*.hook

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 6d4b7530cee1 -r a44b12ee2fd3 tools/hotplug/Linux/vif-bridge
--- a/tools/hotplug/Linux/vif-bridge    Tue May 24 18:33:06 2011 +0100
+++ b/tools/hotplug/Linux/vif-bridge    Wed May 25 10:45:24 2011 +0100
@@ -105,6 +105,8 @@
     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 -r 6d4b7530cee1 -r a44b12ee2fd3 tools/hotplug/Linux/vif-nat
--- a/tools/hotplug/Linux/vif-nat       Tue May 24 18:33:06 2011 +0100
+++ b/tools/hotplug/Linux/vif-nat       Wed May 25 10:45:24 2011 +0100
@@ -185,6 +185,8 @@
 
 handle_iptable
 
+call_hooks vif post
+
 log debug "Successful vif-nat $command for ${dev}."
 if [ "$command" = "online" ]
 then
diff -r 6d4b7530cee1 -r a44b12ee2fd3 
tools/hotplug/Linux/vif-post.d/00-vif-local.hook
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/hotplug/Linux/vif-post.d/00-vif-local.hook  Wed May 25 10:45:24 
2011 +0100
@@ -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 -r 6d4b7530cee1 -r a44b12ee2fd3 tools/hotplug/Linux/vif-route
--- a/tools/hotplug/Linux/vif-route     Tue May 24 18:33:06 2011 +0100
+++ b/tools/hotplug/Linux/vif-route     Wed May 25 10:45:24 2011 +0100
@@ -49,6 +49,8 @@
 
 handle_iptable
 
+call_hooks vif post
+
 log debug "Successful vif-route ${command} for ${dev}."
 if [ "${command}" = "online" ]
 then
diff -r 6d4b7530cee1 -r a44b12ee2fd3 tools/hotplug/Linux/xen-hotplug-common.sh
--- a/tools/hotplug/Linux/xen-hotplug-common.sh Tue May 24 18:33:06 2011 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-common.sh Wed May 25 10:45:24 2011 +0100
@@ -99,4 +99,15 @@
   _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"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.