aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2018-05-02 15:53:04 +0200
committerDee'Kej <deekej@linuxmail.org>2018-05-17 14:49:45 +0200
commite811abf000f525932f6334ce0c06adb3d2860a6d (patch)
treeb8235af37b9c37775e79eb12783bff44eaea13e9 /sysconfig/network-scripts/network-functions
parenteaaea56f8625538e66d8786cc23d808d0581080a (diff)
downloadinitscripts-e811abf000f525932f6334ce0c06adb3d2860a6d.tar
initscripts-e811abf000f525932f6334ce0c06adb3d2860a6d.tar.gz
initscripts-e811abf000f525932f6334ce0c06adb3d2860a6d.tar.bz2
initscripts-e811abf000f525932f6334ce0c06adb3d2860a6d.tar.xz
initscripts-e811abf000f525932f6334ce0c06adb3d2860a6d.zip
network-functions: add error messages for bonding installation
Instead of displaying messages without context, like this: ./network-functions: line 571: echo: write error: Invalid argument ./network-functions: line 598: echo: write error: Permission denied We will now display pretty error messages (via net_log) about what has actually failed... This has been requested by our customer: https://bugzilla.redhat.com/show_bug.cgi?id=1542514
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions22
1 files changed, 17 insertions, 5 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 53e9d41e..343ae97c 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -550,6 +550,8 @@ bond_master_exists ()
install_bonding_driver ()
{
+ local fn="install_bonding_driver"
+
if ! bond_master_exists ${1}; then
modprobe bonding || return 1
echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null
@@ -574,11 +576,15 @@ install_bonding_driver ()
value=${bopts_vals[$idx]}
if [ "${key}" = "mode" ] ; then
- echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key
+ echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key || {
+ net_log $"Failed to set value '$value' [mode] to ${DEVICE} bonding device" err $fn
+ }
bopts_keys[$idx]=""
fi
if [ "${key}" = "miimon" ] ; then
- echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key
+ echo "${value}" > /sys/class/net/${DEVICE}/bonding/$key || {
+ net_log $"Failed to set value '$value' [miimon] to ${DEVICE} bonding device" err $fn
+ }
bopts_keys[$idx]=""
fi
done
@@ -596,16 +602,22 @@ install_bonding_driver ()
IFS=',';
for arp_ip in $value; do
if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then
- echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key
+ echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key || {
+ net_log $"Failed to set '$arp_ip' value [arp_ip_target] to ${DEVICE} bonding device" err $fn
+ }
fi
done
IFS=$OLDIFS;
elif [ "${key}" = "arp_ip_target" ]; then
if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then
- echo "$value" > /sys/class/net/${DEVICE}/bonding/$key
+ echo "$value" > /sys/class/net/${DEVICE}/bonding/$key || {
+ net_log $"Failed to set '$value' value [arp_ip_target] to ${DEVICE} bonding device" err $fn
+ }
fi
elif [ "${key}" != "primary" ]; then
- echo $value > /sys/class/net/${DEVICE}/bonding/$key
+ echo $value > /sys/class/net/${DEVICE}/bonding/$key || {
+ net_log $"Failed to set '$value' value [$key] to ${DEVICE} bonding device" err $fn
+ }
fi
done
fi