From 6a0b8aea5e67811828fed8df836feb64e3da89f9 Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Thu, 25 Dec 2014 20:56:28 +0300 Subject: [PATCH] Check that bond has slaves before commit. --- alterator-net-eth/backend3/net-eth | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/alterator-net-eth/backend3/net-eth b/alterator-net-eth/backend3/net-eth index 352cdc7..be63061 100755 --- a/alterator-net-eth/backend3/net-eth +++ b/alterator-net-eth/backend3/net-eth @@ -46,6 +46,17 @@ is_bond() [ "$(read_iface_option "$ifacedir" TYPE)" = bond ] } +check_bond() +{ + local iface="$1"; shift + + if [ -n "$(read_iface_slaves "$cachedir/$iface")" ]; then + return 0 + else + return 1 + fi +} + real_iface() { local ifacedir="$1"; shift @@ -231,6 +242,12 @@ commit_cache() local old_ipv6configuration="$(read_configuration "/etc/net/ifaces/$ifname" 6)" local new_ipv6configuration="$(read_configuration "$iface" 6)" + # check bond settings + if is_bond "$ifname" && ! check_bond "$ifname"; then + write_error "`_ "Bond inteface $ifname confifiguration is invalid"`" + continue + fi + #update configs rm -rf -- "/etc/net/ifaces/$ifname" if [ -e "$cachedir/$ifname/REMOVED" ]; then