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

[Xen-changelog] Poll for peth0 coming up before trying to attach it to t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Poll for peth0 coming up before trying to attach it to the bridge. This fixes
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Jan 2006 18:04:06 +0000
Delivery-date: Tue, 24 Jan 2006 18:13:16 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 40bb46f599d93a8605740bc5800d5e61d8cc1198
# Parent  991ccc24bf2e437fff0e45c490692f9ca239509e
Poll for peth0 coming up before trying to attach it to the bridge.  This fixes
a problem seen with tg3's needing some time for auto-negotiation, and so the
script would fail.

Patch courtesy of someone who's name has been lost to history.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 991ccc24bf2e -r 40bb46f599d9 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Tue Jan 10 15:05:05 2006
+++ b/tools/examples/network-bridge     Tue Jan 10 15:21:00 2006
@@ -242,10 +242,10 @@
        ip addr flush ${pdev}
        ip link set ${netdev} addr ${mac} arp on
        add_to_bridge ${bridge} ${vif0}
-       add_to_bridge ${bridge} ${pdev}
        ip link set ${bridge} up
        ip link set ${vif0} up
        ip link set ${pdev} up
+       add_to_bridge2 ${bridge} ${pdev}
        do_ifup ${netdev}
     else
        # old style without ${vdev}
@@ -293,6 +293,27 @@
     brctl delbr ${bridge}
 }
 
+# adds $dev to $bridge but waits for $dev to be in running state first
+add_to_bridge2() {
+    local bridge=$1
+    local dev=$2
+    local maxtries=10
+
+    echo -n "Waiting for ${dev} to negotiate link."
+    for i in `seq ${maxtries}` ; do
+       if ifconfig ${dev} | grep -q RUNNING ; then
+           break
+       else
+           echo -n '.'
+           sleep 1
+       fi
+    done
+
+    if [ ${i} -eq ${maxtries} ] ; then echo '(link isnt in running state)' ; fi
+
+    add_to_bridge ${bridge} ${dev}
+}
+
 case "$command" in
     start)
        op_start

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Poll for peth0 coming up before trying to attach it to the bridge. This fixes, Xen patchbot -unstable <=