This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-changelog] [xen-unstable] xend: Do not mess with bridge if admin ha

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: Do not mess with bridge if admin has set one up already
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 16 Jun 2010 00:15:15 -0700
Delivery-date: Wed, 16 Jun 2010 00:16:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1276598187 -3600
# Node ID 856c4684603984f9e853baaa011db9847da0b4eb
# Parent  17354054a6e3a65d5c3e7dc32c45f9b885bb0d11
xend: Do not mess with bridge if admin has set one up already

Previously, the default "network-script",
/etc/xen/scripts/network-bridge, would attempt to do its horrid work
even if you had already set everything up in /etc/network/interfaces.

Setting up your bridge in /etc/network/interfaces is:
 * easy
 * required for libxl since libxl never does it for you
 * not a fragile piece of lunacy
 * properly documented
 * the way everyone would expect it to work

In this small patch we make it so that the default config for xend
doesn't mess about on startup if you already have a bridge, and
doesn't mess about on shutdown unless your first-named bridge (eth0 or
xenbr0, normally) doesn't also have a physical interface named
p<whatever> (peth0 or pxenbr0) enslaved to it.  The latter test is not
ideal but will hopefully do from now until the time xend finally dies.

We also fix the "documentation" - ie, the comments in the default
xend-config.sxp - to correspond to reality.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
 tools/examples/xend-config.sxp     |   21 ++++++++++++++++++---
 tools/hotplug/Linux/network-bridge |    8 ++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff -r 17354054a6e3 -r 856c46846039 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp    Tue Jun 15 11:35:46 2010 +0100
+++ b/tools/examples/xend-config.sxp    Tue Jun 15 11:36:27 2010 +0100
@@ -147,8 +147,22 @@
 # (network-script 'network-bridge netdev=eth1')
-# The bridge is named xenbr0, by default.  To rename the bridge, use
+# The bridge is named eth0, by default (yes, really!)
+# It is normally much better to create the bridge yourself in
+# /etc/network/interfaces.  network-bridge start does nothing if you
+# already have a bridge, and network-bridge stop does nothing if the
+# default bridge name (normally eth0) is not a bridge.  See
+# bridge-utils-interfaces(5) for full information on the syntax in
+# /etc/network/interfaces, but you probably want something like this:
+#    iface xenbr0 inet static
+#        address [etc]
+#        netmask [etc]
+#        [etc]
+#        bridge_ports eth0
+# To have network-bridge create a differently-named bridge, use:
 # (network-script 'network-bridge bridge=<name>')
 # It is possible to use the network-bridge script in more complicated
@@ -169,7 +183,8 @@
 # configuring a new vif, but a value specified here would act as a default.
 # If you are using only one bridge, the vif-bridge script will discover that,
-# so there is no need to specify it explicitly.
+# so there is no need to specify it explicitly.  The default is to use
+# the bridge which is listed first in the output from brctl.
 (vif-script vif-bridge)
diff -r 17354054a6e3 -r 856c46846039 tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge        Tue Jun 15 11:35:46 2010 +0100
+++ b/tools/hotplug/Linux/network-bridge        Tue Jun 15 11:36:27 2010 +0100
@@ -216,6 +216,10 @@ op_start () {
+    if [ `brctl show | wc -l` != 1 ]; then
+        return
+    fi
     if link_exists "$pdev"; then
         # The device is already up.
@@ -263,6 +267,10 @@ op_stop () {
     if ! link_exists "$bridge"; then
+    fi
+    if ! [ -e "/sys/class/net/${bridge}/brif/${pdev}" ]; then
+        # $bridge is not a bridge to which pdev is enslaved
+        return
     claim_lock "network-bridge"

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: Do not mess with bridge if admin has set one up already, Xen patchbot-unstable <=