aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir@xensource.com>2007-07-01 22:20:46 +0100
committerKeir Fraser <keir@xensource.com>2007-07-01 22:20:46 +0100
commit1b3a517175f58da8dab8c4aff5f244e622957212 (patch)
tree2171274ecd7f1510b4018d21b77aee882e397ecb /tools
parent883a5de1d274d5cdfd2bd2ee4a62189e6f25a19f (diff)
downloadxen-1b3a517175f58da8dab8c4aff5f244e622957212.tar.gz
xen-1b3a517175f58da8dab8c4aff5f244e622957212.tar.bz2
xen-1b3a517175f58da8dab8c4aff5f244e622957212.zip
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/examples/network-bridge12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/examples/network-bridge b/tools/examples/network-bridge
index a7ee9067be..6b528d8a48 100755
--- a/tools/examples/network-bridge
+++ b/tools/examples/network-bridge
@@ -172,11 +172,23 @@ show_status () {
echo '============================================================'
}
+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
+}
+
op_start () {
if [ "${bridge}" = "null" ] ; then
return
fi
+ if is_network_root ; then
+ [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting"
+ return
+ fi
+
if link_exists "$pdev"; then
# The device is already up.
return