All of lore.kernel.org
 help / color / mirror / Atom feed
From: "W. Michael Petullo" <mike@flyn.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: Proposal: vif-local
Date: Fri, 6 May 2011 12:06:02 -0500	[thread overview]
Message-ID: <20110506170602.GA4198@imp.local> (raw)
In-Reply-To: <1304671321.26692.117.camel@zakaz.uk.xensource.com>

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

>> 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

[-- Attachment #2: xen-4.1.0-local-vif-scripts.patch --]
[-- Type: text/plain, Size: 2734 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2011-05-06 17:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21  7:04 New 4.0.2 and 4.1.1 release candidates Keir Fraser
2011-05-24  7:24 ` Keir Fraser
2011-05-05 17:15   ` Proposal: vif-local W. Michael Petullo
2011-05-06  8:42     ` Ian Campbell
2011-05-06 17:06       ` W. Michael Petullo [this message]
2011-05-09  8:45         ` Ian Campbell
2011-05-09 17:10           ` W. Michael Petullo
2011-05-10  8:02             ` Ian Campbell
2011-05-10 16:06               ` W. Michael Petullo
2011-05-10 16:12                 ` Ian Campbell
2011-05-24 14:17   ` Re: New 4.0.2 and 4.1.1 release candidates W. Michael Petullo
2011-05-24 15:49     ` Keir Fraser
2011-05-24 17:31     ` Proposal: vif-local [and 1 more messages] Ian Jackson
2011-05-24 17:51       ` Ian Campbell
2011-05-25  9:45         ` Ian Jackson
2011-05-24 16:13 ` New 4.0.2 and 4.1.1 release candidates Olaf Hering
2011-05-24 17:58   ` Keir Fraser
2011-05-24 18:25     ` Olaf Hering
2011-05-24 20:04       ` Keir Fraser
2011-05-26  8:36     ` George Dunlap
2011-05-26  9:09       ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110506170602.GA4198@imp.local \
    --to=mike@flyn.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.