[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Choice of network interface for establishing a bridge on if NFSROOT is used
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |