Refuse to start bridging with network root filesystem
PATCH 1/1 Refuse to start bridging with network root filesystem
Hi,
Since setting up bridging involves bringing down the network interface,
bridging clearly isn't compatible with the likes of NFS or iSCSI root.
The attached patch makes network-bridge try to detect either of these
conditions and refuse to start, logging an error to syslog.
Signed-off-by Mark McLoughlin <[email protected]>
Thanks,
Mark.
tools/examples/network-bridge +12 -0
@@ -172,9 +172,21 @@ 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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel