diff options
author | Martin Schwenke <martin@meltin.net> | 2014-03-27 16:31:54 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2014-05-05 03:55:08 +0200 |
commit | be71a84565e9e7532a77c175732b764d1f42c1cd (patch) | |
tree | ae8e6b04c71043510eec302d75937da0e3a76aeb /ctdb | |
parent | 2995b934409700061a729f5d50dca18f19260d37 (diff) | |
download | samba-be71a84565e9e7532a77c175732b764d1f42c1cd.tar.gz samba-be71a84565e9e7532a77c175732b764d1f42c1cd.tar.xz samba-be71a84565e9e7532a77c175732b764d1f42c1cd.zip |
ctdb-eventscripts: Don't check if $iface is empty
This is the loop variable. It can't be empty, especially given the
way the list is built. This must have survived from an earlier
version of the script.
Given that there are whitespace changes associated with the above,
clean-up the "virtio_net" avoidance check so that it reads less like
line-noise.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/config/events.d/10.interface | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/ctdb/config/events.d/10.interface b/ctdb/config/events.d/10.interface index 32d841f6106..979fa7b7e06 100755 --- a/ctdb/config/events.d/10.interface +++ b/ctdb/config/events.d/10.interface @@ -110,22 +110,24 @@ monitor_interfaces() mark_up $iface ;; *) - [ -z "$iface" ] || { - [ "$(basename $(readlink /sys/class/net/$iface/device/driver) 2>/dev/null)" = virtio_net ] || + # Ignore virtio_net devices, assume they're always up + _driver_path="/sys/class/net/$iface/device/driver" + _driver=$(basename $(readlink "$_driver_path") 2>/dev/null) + [ "$_driver" = "virtio_net" ] && continue + + ethtool $iface | grep -q 'Link detected: yes' || { + # On some systems, this is not successful when a + # cable is plugged but the interface has not been + # brought up previously. Bring the interface up + # and try again... + ip link set $iface up ethtool $iface | grep -q 'Link detected: yes' || { - # On some systems, this is not successful when a - # cable is plugged but the interface has not been - # brought up previously. Bring the interface up and - # try again... - ip link set $iface up - ethtool $iface | grep -q 'Link detected: yes' || { - echo "ERROR: No link on the public network interface $iface" - mark_down $iface - continue - } + echo "ERROR: No link on the public network interface $iface" + mark_down $iface + continue } - mark_up $iface } + mark_up $iface ;; esac |