Do additional checks in OCF only for action monitor.
W/o this change, the *monitor() function of OCF scripts
do additional AMQP connection checks unconditionally, every
time it has been invoked. And that could cause *too much* netstat
invocations for host OS to handle them w/o an issues.
By design, we want these additional checks performed only when
OCF script being invoked as a monitor action, but not as a start
or stop, for example.
The solution is:
* check if $__OCF_ACTION = monitor and do AMQP checks only then.
* align sleep (3 sec) for action start loop amongst all of the OCF scripts
* replace netstat to lsof tool due to /proc FS based approach
for sockets parsing fits better for high loaded systems with
many connections. Also, 'lsof -p $pid' will not search for all
of the existing sockets - which could be tens of housands -
but only for ones from /proc/$pid/ instead, that is very fast and
provides no additional load for host OS.
Reviewed: https:/ /review. openstack. org/139053 /git.openstack. org/cgit/ stackforge/ fuel-library/ commit/ ?id=cb75bea0d0c 9474c9d25502130 f735399e8a94e5
Committed: https:/
Submitter: Jenkins
Branch: master
commit cb75bea0d0c9474 c9d25502130f735 399e8a94e5
Author: Bogdan Dobrelya <email address hidden>
Date: Thu Dec 4 14:37:09 2014 +0100
Do additional checks in OCF only for action monitor.
W/o this change, the *monitor() function of OCF scripts
do additional AMQP connection checks unconditionally, every
time it has been invoked. And that could cause *too much* netstat
invocations for host OS to handle them w/o an issues.
By design, we want these additional checks performed only when
OCF script being invoked as a monitor action, but not as a start
or stop, for example.
The solution is:
* check if $__OCF_ACTION = monitor and do AMQP checks only then.
* align sleep (3 sec) for action start loop amongst all of the OCF scripts
* replace netstat to lsof tool due to /proc FS based approach
for sockets parsing fits better for high loaded systems with
many connections. Also, 'lsof -p $pid' will not search for all
of the existing sockets - which could be tens of housands -
but only for ones from /proc/$pid/ instead, that is very fast and
provides no additional load for host OS.
Closes-bug: #1385755
Change-Id: I4eba9fd5e3eaa6 448590808ea85bd f152b2ef176
Signed-off-by: Bogdan Dobrelya <email address hidden>