From fafa6d418afe04d9b79326a621091d9d6c5f74f4 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Tue, 5 Mar 2024 11:47:26 +0000 Subject: [PATCH] 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 --- src/lib/charm/openstack/ovn_central.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib/charm/openstack/ovn_central.py b/src/lib/charm/openstack/ovn_central.py index c8cc35e..d56ef8b 100644 --- a/src/lib/charm/openstack/ovn_central.py +++ b/src/lib/charm/openstack/ovn_central.py @@ -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.