| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright (C) 2012-2015 Jiri Pirko <[email protected]> |
| 4 |
# |
| 5 |
# This library is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU Lesser General Public |
| 7 |
# License as published by the Free Software Foundation; either |
| 8 |
# version 2.1 of the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This library is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# Lesser General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU Lesser General Public |
| 16 |
# License along with this library; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
|
| 19 |
. /etc/init.d/functions |
| 20 |
|
| 21 |
cd /etc/sysconfig/network-scripts |
| 22 |
. ./network-functions |
| 23 |
|
| 24 |
[ -f ../network ] && . ../network |
| 25 |
|
| 26 |
CONFIG=${1} |
| 27 |
|
| 28 |
need_config "${CONFIG}" |
| 29 |
|
| 30 |
source_config |
| 31 |
|
| 32 |
if [ "${DEVICETYPE}" = "TeamPort" ]; then |
| 33 |
# This means that this was called directly, not via ifup-eth |
| 34 |
# so execute ifup-eth now. |
| 35 |
/etc/sysconfig/network-scripts/ifup-eth ${CONFIG} $2 |
| 36 |
fi |
| 37 |
|
| 38 |
if [ -n "${TEAM_MASTER}" ]; then |
| 39 |
if [ ! -x /usr/bin/teamdctl ]; then |
| 40 |
net_log $"Team support not available: teamdctl not found" |
| 41 |
exit 1 |
| 42 |
fi |
| 43 |
/sbin/ip link show ${TEAM_MASTER} > /dev/null 2>&1 |
| 44 |
if [ $? -ne 0 ]; then |
| 45 |
net_log $"Team master is not present yet, delaying port device initialization" info |
| 46 |
exit 0 |
| 47 |
fi |
| 48 |
/usr/bin/teamdctl ${TEAM_MASTER} port present ${DEVICE} 2> /dev/null |
| 49 |
if [ $? -eq 0 ]; then |
| 50 |
# port is already part of the team, nothing to do |
| 51 |
exit 0 |
| 52 |
fi |
| 53 |
/sbin/ip link set dev ${DEVICE} down |
| 54 |
if [ -n "${TEAM_PORT_CONFIG}" ]; then |
| 55 |
/usr/bin/teamdctl ${TEAM_MASTER} port config update ${DEVICE} "${TEAM_PORT_CONFIG}" || exit 1 |
| 56 |
fi |
| 57 |
/usr/bin/teamdctl ${TEAM_MASTER} port add ${DEVICE} || exit 1 |
| 58 |
fi |