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
(cherry picked from commit fafa6d418a)
(cherry picked from commit 05722e0fbc)
(cherry picked from commit 0a7904fba2)
(cherry picked from commit 202684c9f7)
This commit is contained in:
Edward Hope-Morley 2024-03-05 11:47:26 +00:00 committed by Nicolas Bock
parent 82e93d358c
commit 633d78bdbd
2 changed files with 25 additions and 1 deletions

View File

@ -171,7 +171,7 @@
"package": "charmhelpers",
"url": "git+https://github.com/juju/charm-helpers.git",
"branch": "refs/heads/stable/yoga",
"version": "971ac5117c96bd1cb4a6a520787e4509564da582",
"version": "e9dfd069b1ff29d39a3f06829f299709f102d887",
"vcs": "git"
},
{

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
@ -361,6 +364,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.