Use SSL compatible service status check

Override the layer_ovn method used to check if services
are running so that we can use SSL connections instead
of netcat since the latter causes problems with
ovsdb-server due to connections not being closed
properly.

Closes-Bug: #1920770
Change-Id: I6b2c09c643c6fddfb48dc15d6272e58303fae265
This commit is contained in:
Edward Hope-Morley 2024-03-05 11:47:26 +00:00
parent a4df338dd4
commit fafa6d418a

View File

@ -25,7 +25,10 @@ import charmhelpers.contrib.network.ovs.ovn as ch_ovn
import charmhelpers.contrib.network.ovs.ovsdb as ch_ovsdb
from charmhelpers.contrib.network import ufw as ch_ufw
import charmhelpers.contrib.openstack.deferred_events as deferred_events
import charmhelpers.contrib.hahelpers.cluster as ch_cluster
import charmhelpers.contrib.openstack.utils as os_utils
import charmhelpers.fetch as ch_fetch
from charmhelpers.contrib.network.ip import SSLPortCheckInfo
import charms.reactive as reactive
@ -380,6 +383,27 @@ class BaseOVNCentralCharm(charms_openstack.charm.OpenStackCharm):
.format(self.min_election_timer, self.max_election_timer))
return None, None
def check_services_running(self):
"""
The default charms.openstack/layer_openstack handler will use netcat to
check if services are running. This causes the ovsdb-server logs to
get spammed with SSL protocol errors and warnings because netcat does
not close the connection properly. We override this method to request
that services be tested using SSL connections.
"""
_services, _ports = ch_cluster.get_managed_services_and_ports(
self.services,
self.ports_to_check(self.active_api_ports))
ssl_info = SSLPortCheckInfo(os.path.join(self.ovn_sysconfdir(),
'key_host'),
os.path.join(self.ovn_sysconfdir(),
'cert_host'),
os.path.join(self.ovn_sysconfdir(),
'ovn-central.crt'))
return os_utils.ows_check_services_running(services=_services,
ports=_ports,
ssl_check_info=ssl_info)
def custom_assess_status_last_check(self):
"""Customize charm status output.