tripleo-common/healthcheck/ironic-inspector
Bob Fournier e284c5f75b Use healthcheck_port for ironic_inspector_dnsmasq healthcheck
ironic_inspector_dnsmasq healthchecks currently use healthcheck_listen()
to check if dnsmasq is listening for udp packets on the DHCP port. In
Train we are seeing occasional failures with this healthcheck. It may be
the same issue as in https://bugs.launchpad.net/tripleo/+bug/1860556,
which was resolved for healthcheck_port but not for healthcheck_listen.

It appears that this has been redone in master to get away from 'ss' -
https://review.opendev.org/#/c/708339/. However, in master healthcheck_listen
only works with tcp ports, so the ironic_inspector_dnsmasq healthcheck
fails in master too.

A better way is to use healthcheck_port for ironic_inspector_dnsmasq
healthchecks. Since this is a udp port, this will work with Train and master

Change-Id: I16e6d462b0eca60e75eb5b91259575e62f17fe31
Closes-Bug: 1873049
2020-04-15 13:56:01 -04:00

24 lines
851 B
Bash
Executable File

#!/bin/sh
. ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
process='dnsmasq'
if pgrep $process; then
listen_address=$(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_address 127.0.0.1)
# Check DHCPv6 port if using IPv6
if [[ $listen_address =~ ":" ]]; then
port="547"
else
port="67"
fi
echo "Checking $process port(s) $port."
if ! healthcheck_port $process $port; then
echo "There is no $process process listening on port(s) $port in the container."
exit 1
fi
else
bind_host=$(wrap_ipv6 $(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_address 127.0.0.1))
bind_port=$(get_config_val /etc/ironic-inspector/inspector.conf DEFAULT listen_port 5050)
healthcheck_curl http://${bind_host}:${bind_port}
fi