-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[dhcp_relay] Only attempt to start 'isc-dhcp-relay' group if it is not empty #1713
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if supervisorctl status | grep -q "^isc-dhcp-relay:"; then
do the same, but faster
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) 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. |
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.