Skip to content
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

[multi-Asic] Add support for multi-asic to swssloglevel #5316

Merged
merged 5 commits into from
Sep 16, 2020

Conversation

judyjoseph
Copy link
Contributor

@judyjoseph judyjoseph commented Sep 4, 2020

- Why I did it
Add the option -n to specify the swss docker instance running in a particular namespace to invoke swssloglevel.

- How I did it
Update the script swssloglevel.

- How to verify it

The following options in multi-asic platform.

admin@str-acs-1:~$ swssloglevel 
Usage: /usr/bin/swssloglevel -n [0 to 3] [OPTION]... 
admin@str-acs-1:~$ swssloglevel -h
Usage: /usr/bin/swssloglevel -n [0 to 3] [OPTION]...
admin@str--acs-1:~$ swssloglevel -n 0 
Invalid loglevel value

Usage: swssloglevel [OPTIONS]
SONiC logging severity level setting.

Options:
	 -h	print this message
	 -l	loglevel value
	 -c	component name in DB for which loglevel is applied (provided with -l)
	 -a	apply loglevel to all components (provided with -l)
	 -s	apply loglevel for SAI api component (equivalent to adding prefix "SAI_API_" to component)
	 -p	print components registered in DB for which setting can be applied

Examples:
	swssloglevel -l NOTICE -c orchagent # set orchagent severity level to NOTICE
	swssloglevel -l SAI_LOG_LEVEL_ERROR -s -c SWITCH # set SAI_API_SWITCH severity to ERROR
	swssloglevel -l SAI_LOG_LEVEL_DEBUG -s -a # set all SAI_API_* severity to DEBUG
admin@str--acs-1:~$ swssloglevel -n 0 -l SAI_LOG_LEVEL_DEBUG -s -a
admin@str--acs-1:~$ 

- Which release branch to backport (provide reason below if selected)

  • 201811
  • [x ] 201911
  • [ x] 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@lguohan lguohan requested a review from shi-su September 4, 2020 17:05
docker exec -$DOCKER_EXEC_FLAGS swss swssloglevel "$@"
function help()
{
echo -e "Usage: $0 -n [0 to $(($NUM_ASIC-1))], where n is the namespace instance" 1>&2; exit 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it would be good to add something like [OPTIONS] in this help message? I feel it might be confusing that this help suggest using swssloglevel -n [0 to n] when inputting swssloglevel, and it shows another completely different help message without a -n option with swssloglevel -n 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, I have updated the help string so user knows there are more options.

@judyjoseph
Copy link
Contributor Author

judyjoseph commented Sep 9, 2020

retest this please

1 similar comment
@judyjoseph
Copy link
Contributor Author

retest this please

}

DEV=""
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can use the env file to reduce the overhead of this call.

Copy link
Contributor Author

@judyjoseph judyjoseph Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks ! updated to use the env file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan, Could you confirm if the changes are ok.

@judyjoseph
Copy link
Contributor Author

@lguohan @arlakshm please let me know if it looks ok.

@judyjoseph judyjoseph merged commit 642479f into sonic-net:master Sep 16, 2020
@judyjoseph judyjoseph deleted the swssloglevel branch September 16, 2020 18:29
@judyjoseph
Copy link
Contributor Author

@abdosi Please take this into 201911 as well. thanks

abdosi pushed a commit that referenced this pull request Sep 28, 2020
* Support for multi-asic platform for swssloglevel command

admin@str-acs-1:~$ swssloglevel 
Usage: /usr/bin/swssloglevel -n [0 to 3] [OPTION]... 

* Update to use the env file to get the PLATFORM string.
santhosh-kt pushed a commit to santhosh-kt/sonic-buildimage that referenced this pull request Feb 25, 2021
* Support for multi-asic platform for swssloglevel command

admin@str-acs-1:~$ swssloglevel 
Usage: /usr/bin/swssloglevel -n [0 to 3] [OPTION]... 

* Update to use the env file to get the PLATFORM string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants