From mboxrd@z Thu Jan 1 00:00:00 1970 From: "W. Michael Petullo" Subject: Re: Proposal: vif-local Date: Fri, 6 May 2011 12:06:02 -0500 Message-ID: <20110506170602.GA4198@imp.local> References: <20110505171542.GA17115@imp.local> <1304671321.26692.117.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Return-path: Content-Disposition: inline In-Reply-To: <1304671321.26692.117.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline >> For site-specific reasons, I use the network-route/vif-route scripts. I >> have found that we need to maintain a few custom firewall rules in order >> to make things operate in an acceptable manner. I'd like to see a place >> to put such scripts and any other site-specific setup related to bringing >> up a vif. Keeping this separate from vif-route is useful so that the >> installed scripts may be kept unmodified. >> >> What I have come up with is vif-local, a script that lives in >> /etc/xen/scripts. I modified vif-route to call vif-local right before >> it logs "Successful..." > I think it would be better to be more general and support a vif-post.d > style directory which can contain scripts all of which are called (with > a defined set of paramters/env variables). > Not sure if we want vif-{route,bridge,etc}-post.d or not, perhaps that's > overkill. Using -post.d leaves open the option to add -pre.d in the > future as necessary. I have attached a patch against Xen 4.1.0 that implements a vif-post.d system. I only support the Linux hotplug case at this point. -- Mike :wq --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xen-4.1.0-local-vif-scripts.patch" diff -u --recursive --new-file xen-4.1.0-vanilla/tools/hotplug/Linux/vif-bridge xen-4.1.0/tools/hotplug/Linux/vif-bridge --- xen-4.1.0-vanilla/tools/hotplug/Linux/vif-bridge 2011-05-06 10:39:15.848610384 -0500 +++ xen-4.1.0/tools/hotplug/Linux/vif-bridge 2011-05-06 10:55:55.347672818 -0500 @@ -105,6 +105,10 @@ handle_iptable fi +for f in /etc/xen/scripts/vif-post.d/*; do + [ -x $f ] && $f +done + log debug "Successful vif-bridge $command for $dev, bridge $bridge." if [ "$type_if" = vif -a "$command" = "online" ] then diff -u --recursive --new-file xen-4.1.0-vanilla/tools/hotplug/Linux/vif-nat xen-4.1.0/tools/hotplug/Linux/vif-nat --- xen-4.1.0-vanilla/tools/hotplug/Linux/vif-nat 2011-05-06 10:39:15.847610424 -0500 +++ xen-4.1.0/tools/hotplug/Linux/vif-nat 2011-05-06 10:56:10.629062183 -0500 @@ -185,6 +185,10 @@ handle_iptable +for f in /etc/xen/scripts/vif-post.d/*; do + [ -x $f ] && $f +done + log debug "Successful vif-nat $command for ${dev}." if [ "$command" = "online" ] then diff -u --recursive --new-file xen-4.1.0-vanilla/tools/hotplug/Linux/vif-post.d/00-vif-local xen-4.1.0/tools/hotplug/Linux/vif-post.d/00-vif-local --- xen-4.1.0-vanilla/tools/hotplug/Linux/vif-post.d/00-vif-local 1969-12-31 18:00:00.000000000 -0600 +++ xen-4.1.0/tools/hotplug/Linux/vif-post.d/00-vif-local 2011-05-06 11:54:04.258077228 -0500 @@ -0,0 +1,20 @@ +#============================================================================ +# ${XEN_SCRIPT_DIR}/vif-post.d/00-vif-local +# +# 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. +# +# Usage: +# vif-local (add|remove|online|offline) +# +# Environment vars: +# 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 -u --recursive --new-file xen-4.1.0-vanilla/tools/hotplug/Linux/vif-route xen-4.1.0/tools/hotplug/Linux/vif-route --- xen-4.1.0-vanilla/tools/hotplug/Linux/vif-route 2011-05-06 10:39:15.845610504 -0500 +++ xen-4.1.0/tools/hotplug/Linux/vif-route 2011-05-06 12:00:06.029751382 -0500 @@ -49,6 +49,10 @@ handle_iptable +for f in /etc/xen/scripts/vif-post.d/*; do + [ -x $f ] && . $f +done + log debug "Successful vif-route ${command} for ${dev}." if [ "${command}" = "online" ] then --6TrnltStXW4iwmi0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --6TrnltStXW4iwmi0--