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] [xen-unstable] Choice of network interface for establish

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Choice of network interface for establishing a bridge on if NFSROOT is used
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jul 2008 06:10:09 -0700
Delivery-date: Mon, 14 Jul 2008 06:10:00 -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 1216026281 -3600
# Node ID e2cec672528081e52c7b1dc0914decf98916598a
# Parent  b01303f598720dfe372bd26cd316ea45662cfaac
Choice of network interface for establishing a bridge on if NFSROOT is used

This patch fixes a problem related to machines that are booted using
nfsroot ( '/' provided via nfs). Previously the code was assuming that
nfsroot would be provided via eth0. Now this additional code checks
over which interface the nfsroot is provided after detecting that
nfsroot is actually being used. To determine from where nfsroot is
mounted I am reading the kernel command line (/proc/cmdline) and
filter for an argument starting with 'nfsroot=' and determine the nfs
server's IP address by assuming the format 'nfsroot=<ip
adddress>:<path to root>' - if there's a better way of doing this,
please let me know.  After that I determine the interface over which
this IP address would be accessed using 'ip route get <address>'. Then
I compare that interface against a previously determined default
interface and if they are equal return a value that causes an
alternative interface to be chosen.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/examples/network-bridge |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)

diff -r b01303f59872 -r e2cec6725280 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Mon Jul 14 10:03:09 2008 +0100
+++ b/tools/examples/network-bridge     Mon Jul 14 10:04:41 2008 +0100
@@ -60,7 +60,18 @@ is_network_root () {
     local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' 
/etc/mtab)
     local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' 
/etc/mtab)
 
-    [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && return 0 || 
return 1
+    [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && 
has_nfsroot=1 || has_nfsroot=0
+    if [ $has_nfsroot -eq 1 ]; then
+        local bparms=$(cat /proc/cmdline)
+        for p in $bparms; do
+            local ipaddr=$(echo $p | awk /nfsroot=/'{ print 
substr($1,9,index($1,":")-9) }')
+            if [ "$ipaddr" != "" ]; then
+                local nfsdev=$(ip route get $ipaddr | awk /$ipaddr/'{ print $3 
}')
+                [[ "$nfsdev" == "$netdev" ]] && return 0 || return 1
+            fi
+        done
+    fi
+    return 1
 }
 
 find_alt_device () {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Choice of network interface for establishing a bridge on if NFSROOT is used, Xen patchbot-unstable <=