direct-io.hg

changeset 15440:ccf240f99263

Make network-bridge fail on NFS or iscsi root.
Since setting up bridging involves bringing down the network interface,
bridging clearly isn't compatible with the likes of NFS or iSCSI root.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
author Keir Fraser <keir@xensource.com>
date Sun Jul 01 22:20:46 2007 +0100 (2007-07-01)
parents a3a0202af8a4
children 6e8199e555a6
files tools/examples/network-bridge
line diff
     1.1 --- a/tools/examples/network-bridge	Sun Jul 01 22:18:04 2007 +0100
     1.2 +++ b/tools/examples/network-bridge	Sun Jul 01 22:20:46 2007 +0100
     1.3 @@ -172,11 +172,23 @@ show_status () {
     1.4      echo '============================================================'
     1.5  }
     1.6  
     1.7 +is_network_root () {
     1.8 +    local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab)
     1.9 +    local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
    1.10 +
    1.11 +    [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && return 0 || return 1
    1.12 +}
    1.13 +
    1.14  op_start () {
    1.15      if [ "${bridge}" = "null" ] ; then
    1.16  	return
    1.17      fi
    1.18  
    1.19 +    if is_network_root ; then
    1.20 +        [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting"
    1.21 +        return
    1.22 +    fi
    1.23 +
    1.24      if link_exists "$pdev"; then
    1.25          # The device is already up.
    1.26          return