It seems lsof is a bit too heavy on the system when multiple
healthchecks are running in parallel.
So instead of calling a "big" process, let's split a bit things and get
to the filesystem directly in order to pick only the things we actually
need.
What changes:
- using /proc/net/{tcp,udp}, we get every socket matching the port
- using find with the right options, we can ensure at least one socket
exists with the wanted inode(s)
The last part exits as soon as we have a match in order to make it
faster and less resource consuming.
Change-Id: I64776992a7e457781aa8ddaba359ef085d4cb77d
Partial-Bug: #1921714
(cherry picked from commit a072a7f07ea75933a2372b1a95ae960095a3250e)
Reviewed: https:/ /review. opendev. org/c/openstack /tripleo- common/ +/785325 /opendev. org/openstack/ tripleo- common/ commit/ 654dc08547accf2 f4804e15cb1a5b9 a7d93ae2a0
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/ussuri
commit 654dc08547accf2 f4804e15cb1a5b9 a7d93ae2a0
Author: Cédric Jeanneret <email address hidden>
Date: Tue Apr 6 17:46:43 2021 +0200
healthcheck _port: drop lsof in favor of awk/find
It seems lsof is a bit too heavy on the system when multiple
healthchecks are running in parallel.
So instead of calling a "big" process, let's split a bit things and get
to the filesystem directly in order to pick only the things we actually
need.
What changes: {tcp,udp} , we get every socket matching the port
- using /proc/net/
- using find with the right options, we can ensure at least one socket
exists with the wanted inode(s)
The last part exits as soon as we have a match in order to make it
faster and less resource consuming.
Change-Id: I64776992a7e457 781aa8ddaba359e f085d4cb77d 3a2372b1a95ae96 0095a3250e)
Partial-Bug: #1921714
(cherry picked from commit a072a7f07ea7593