WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] network-bridge: Fix for bonding

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] network-bridge: Fix for bonding
From: "KUWAMURA Shin'ya" <kuwa@xxxxxxxxxxxxxx>
Date: Wed, 22 Apr 2009 17:29:19 +0900 (JST)
Delivery-date: Wed, 22 Apr 2009 01:30:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

If ${netdev} is bonding, brctl addif ${bridge} ${pdev} fails:
  can't add ${pdev} to bridge ${bridge}: Invalid argument
Because ${pdev} has no slaves at this point. 
# Notice that ifdown ${netdev} clears slaves of ${netdev}.

This patch restores slaves before add_to_bridge2 ${bridge} ${pdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
-- 
  KUWAMURA Shin'ya
# HG changeset patch
# User KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
# Date 1240388829 -32400
# Node ID 7c8bdef80b3175a36ebfe11dab70d5a8b4faea5f
# Parent  655dc3bc1d8ee15465f9ce14a1dc23f1f01c639a
network-bridge: Fix for bonding

If ${netdev} is bonding, brctl addif ${bridge} ${pdev} fails:
  can't add ${pdev} to bridge ${bridge}: Invalid argument
Because ${pdev} has no slaves at this point.
# Notice that ifdown ${netdev} clears slaves of ${netdev}.

This patch restores slaves before add_to_bridge2 ${bridge} ${pdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>

diff -r 655dc3bc1d8e -r 7c8bdef80b31 tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge        Thu Apr 16 11:54:06 2009 +0100
+++ b/tools/hotplug/Linux/network-bridge        Wed Apr 22 17:27:09 2009 +0900
@@ -223,6 +223,10 @@ op_start () {
 
     preiftransfer ${netdev}
     transfer_addrs ${netdev} ${tdev}
+    # Remember slaves for bonding interface.
+    if [ -e /sys/class/net/${netdev}/bonding/slaves ]; then
+       slaves=`cat /sys/class/net/${netdev}/bonding/slaves`
+    fi
     # Remember the IP details for do_ifup.
     get_ip_info ${netdev}
     if ! ifdown ${netdev}; then
@@ -234,6 +238,11 @@ op_start () {
 
     setup_bridge_port ${pdev}
 
+    # Restore slaves
+    if [ -n "${slaves}" ]; then
+       ip link set ${pdev} up
+       ifenslave ${pdev} ${slaves}
+    fi
     add_to_bridge2 ${bridge} ${pdev}
     do_ifup ${bridge}
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] network-bridge: Fix for bonding, KUWAMURA Shin'ya <=