Skip to content

Commit

Permalink
Make sure the global abort variable is used
Browse files Browse the repository at this point in the history
Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
  • Loading branch information
saiarcot895 committed Jun 2, 2023
1 parent 01852c6 commit 18fba7c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/teamd_increase_retry_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def craftLacpPacket(portChannelConfig, portName, isResetPacket=False, newVersion
return packet

def sendLacpPackets(packets, revertPackets):
global revertTeamdRetryCountChanges
while not revertTeamdRetryCountChanges:
for port, packet in packets:
sendp(packet, iface=port)
Expand All @@ -198,6 +199,7 @@ def sendLacpPackets(packets, revertPackets):
sendp(packet, iface=port)

def abortTeamdChanges(signum, frame):
global revertTeamdRetryCountChanges
log.log_info("Got signal {}, reverting teamd retry count change".format(signum))
revertTeamdRetryCountChanges = True

Expand Down Expand Up @@ -275,6 +277,7 @@ def main(probeOnly=False):
log.log_error("ERROR: There are port channels/peer devices that failed the probe: {}".format(failedPortChannels), also_print_to_console=True)
sys.exit(2)
else:
global revertTeamdRetryCountChanges
signal.signal(signal.SIGUSR1, abortTeamdChanges)
signal.signal(signal.SIGTERM, abortTeamdChanges)
(_, rc) = getCmdOutput(["config", "portchannel", "retry-count", "get", list(portChannels)[0]])
Expand Down

0 comments on commit 18fba7c

Please sign in to comment.