LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0015-initscripts-do-not-try-to-re-add-port-if-it-is-alrea.patch of Package libteam (Project home:ods:ppc64)

From f01d3a01cf2c12a8974dd05a558d6182a15a986e Mon Sep 17 00:00:00 2001
From: Jiri Pirko <jiri@resnulli.us>
Date: Thu, 27 Mar 2014 14:25:19 +0100
Subject: [patch libteam 2/2] initscripts: do not try to re-add port if it is
 already there

The thing is that first, the port is downed and after that the teamdctl
util is used to add it. When the port is already there, the only effect
is that the port goes down. Fix this by checking if port is already in team.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 teamd/redhat/initscripts/network-scripts/ifup-TeamPort         | 5 +++++
 teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/teamd/redhat/initscripts/network-scripts/ifup-TeamPort b/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
index 3e6010d..4a79302 100755
--- a/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
+++ b/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
@@ -45,6 +45,11 @@ if [ "${DEVICETYPE}" = "TeamPort" ]; then
 		net_log $"Team master is not present yet, delaying port device initialization" info
 		exit 0
 	fi
+	/usr/bin/teamdctl ${TEAM_MASTER} port present ${DEVICE} 2> /dev/null
+	if [ $? -eq 0 ]; then
+		# port is already part of the team, nothing to do
+		exit 0
+	fi
 	/sbin/ip link set dev ${DEVICE} down
 	if [ -n "${TEAM_PORT_CONFIG}" ]; then
 		/usr/bin/teamdctl ${TEAM_MASTER} port config update ${DEVICE} "${TEAM_PORT_CONFIG}" || exit 1
diff --git a/teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort b/teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort
index 3e6010d..4a79302 100755
--- a/teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort
+++ b/teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort
@@ -45,6 +45,11 @@ if [ "${DEVICETYPE}" = "TeamPort" ]; then
 		net_log $"Team master is not present yet, delaying port device initialization" info
 		exit 0
 	fi
+	/usr/bin/teamdctl ${TEAM_MASTER} port present ${DEVICE} 2> /dev/null
+	if [ $? -eq 0 ]; then
+		# port is already part of the team, nothing to do
+		exit 0
+	fi
 	/sbin/ip link set dev ${DEVICE} down
 	if [ -n "${TEAM_PORT_CONFIG}" ]; then
 		/usr/bin/teamdctl ${TEAM_MASTER} port config update ${DEVICE} "${TEAM_PORT_CONFIG}" || exit 1
-- 
1.8.5.3