-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling deletion of Port Channel before deletion of its members #1062
Conversation
@madhanmellanox why do we get the usage when there is a specific error message due to the new checker? |
config/main.py
Outdated
@@ -1230,7 +1230,10 @@ def add_portchannel(ctx, portchannel_name, min_links, fallback): | |||
def remove_portchannel(ctx, portchannel_name): | |||
"""Remove port channel""" | |||
db = ctx.obj['db'] | |||
db.set_entry('PORTCHANNEL', portchannel_name, None) | |||
if len([(k, v) for k, v in db.get_table('PORTCHANNEL_MEMBER') if k == portchannel_name]) != 0: | |||
ctx.fail("Portchannel {} contains members. Remove members before deleting Portchannel!".format(portchannel_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace 'Portchannel' with 'Port channel'.
doc/Command-Reference.md
Outdated
@@ -4838,6 +4838,8 @@ Command takes two optional arguements given below. | |||
1) min-links - minimum number of links required to bring up the portchannel | |||
2) fallback - true/false. LACP fallback feature can be enabled / disabled. When it is set to true, only one member port will be selected as active per portchannel during fallback mode. Refer https://github.com/Azure/SONiC/blob/master/doc/lag/LACP%20Fallback%20Feature%20for%20SONiC_v0.5.md for more details about fallback feature. | |||
|
|||
A portchannel can be deleted only if it does not have any members or the members are already deleted. When a user tries to delete a portchannel and the portchannel still has one or more members that exist, the deletion of portchannel is blocked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace 'Portchannel' with 'Port channel'.
IMO portchannel as CLI command, this is what we have as we dont have spaces. but for comments or CLI output messages i believe we should use it with space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in the next commit.
…rror. Also, references of portchannel is replaced with port channel in the command reference guide
Addressed in the next commit. |
@madhanmellanox , Liat has "requested changes". Can you ask Liat for approval? |
@liat-grozovik can you please approve this PR? |
@prsunny can this PR be cherry picked to 201911? |
@yxieca can this PR be cherry picked to 201911? |
* Handling deletion of Portchannel before deletion of its members * removed a extra space in the condifitional statement * added Note about portchannel deletion in Command-Reference guide * removed ctx.fail() and replaced it with click.echo() to display the error. Also, references of portchannel is replaced with port channel in the command reference guide Co-authored-by: Madhan Babu <madhan@arc-build-server.mtr.labs.mlnx>
Revert "Revert " [201911]show interface counters for multi ASIC devices (sonic-net#1104)"" Revert "Revert "Pfcstat (sonic-net#1097)"" [show] Fix 'show int neighbor expected' (sonic-net#1106) Update argument for docker exec it->i (sonic-net#1118) Update to make config load/reload backward compatible. (sonic-net#1115) Handling deletion of Port Channel before deletion of its members (sonic-net#1062) Skip default route present in ASIC-DB but not in APP-DB. (sonic-net#1107) [CLI][PFCWD][Multi-ASIC] Added multi ASIC support to 'pfcwd' CLI (sonic-net#1102) [201911] Multi asic platform config interface portchannel, show transceiver (sonic-net#1087) [drop counters] Fix configuration for counters with lowercase names (sonic-net#1103) Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
What I did
Handled configuration code to block deletion of Port channel when user tries to delete a Port channel before deleting its members.
How I did it
In the sonic-utilities/config/main.py, where the removal of Port channel configuration is handled, I added a check whether the Port channel to be deleted has any members. If members exist, I will block the configuration of deleting the port channel.
How to verify it
Create a Portchannel. Add 2 switch ports to it as members. Then try to delete the port channel. Now, the deletion of port channel should be blocked by the config since it has port channel members still existing.
Previous command output (if the output of a command-line utility has changed)