[dhcp_relay] Only attempt to start 'isc-dhcp-relay' group if it is not empty#1713
[dhcp_relay] Only attempt to start 'isc-dhcp-relay' group if it is not empty#1713jleveque merged 1 commit intosonic-net:masterfrom jleveque:eliminate_err_msg
Conversation
| # of the process. | ||
| /usr/bin/wait_for_intf.sh | ||
| # If our supervisor config has entries in the "isc-dhcp-relay" group... | ||
| if [ $(supervisorctl status | grep -c "^isc-dhcp-relay:") -gt 0 ]; then |
There was a problem hiding this comment.
if supervisorctl status | grep -q "^isc-dhcp-relay:"; then do the same, but faster
There was a problem hiding this comment.
Hmm... "grep -q" actually seems slower for me...
root@sonic:/# time supervisorctl status | grep -c "^isc-dhcp-relay:"
1
real 0m0.443s
user 0m0.348s
sys 0m0.088s
root@sonic:/# time supervisorctl status | grep -q "^isc-dhcp-relay:"
real 0m0.470s
user 0m0.384s
sys 0m0.068s
There was a problem hiding this comment.
:) when you write [ you run an external command in the bash script
$ which [
/usr/bin/[
So bash must to run subprocess to calculate the boolean for your if
Executing the subprocess is not so fast.
Faster would be use [[ which is internal bash instruction.
Or just use error code from grep directly as I wrote in the first comment.
|
Should we not start the container on host, instead of starting it and keeping a rsyslogd running? |
|
@qiluo-msft: I agree we shouldn't start the service at all, but we don't have a good mechanism for that. We need to think about that some more. |
…D automatically (sonic-net#1713) #### Why I did it src/sonic-sairedis ``` * c5ae534a - (HEAD -> 202412, origin/HEAD, origin/202412) Fix syncd crash due to attr obj list not initialized (sonic-net#92) (16 hours ago) [mssonicbld] ``` #### How I did it #### How to verify it #### Description for the changelog
DHCP relay is only expected to run on T0 devices. On T1 devices, the "isc-dhcp-relay" group in the supervisor config file will not get populated. When Docker container is started, calling
supervisorctl start isc-dhcp-relay:*with no entries in the "isc-dhcp-relay" group will generate an error message to the syslog (INFO supervisord: start.sh isc-dhcp-relay: ERROR (no such group)). This PR prevents us from receiving this erroneous error message.