aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Royo <froyo@redhat.com>2022-10-26 17:34:24 +0200
committerJake Hunsaker <jhunsake@redhat.com>2022-10-31 09:26:37 -0400
commitd5cb9163fd09faaa2e2993645f85f6cd83289a4a (patch)
tree39c3f357cd0d4015e9cd51d6d97f1432bee34084
parent21101d80610c43a7c00de3dfaa5ff043d1f8324a (diff)
downloadsos-d5cb9163fd09faaa2e2993645f85f6cd83289a4a.tar.gz
[ovn_central] Query ovn_controller SBDB connection with ovn-appctl
This additional command will tell us the ovn_controller connection status to OVN SBDB. This is done thanks to ovn-appctl command using -t option to specify the target over the ovn_controller socket, a function has been created in order to located the ovn_controller socket path that is name is different from each controller node. Signed-off-by: Fernando Royo <froyo@redhat.com>
-rw-r--r--sos/report/plugins/ovn_central.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
index f5c1d581..4f629758 100644
--- a/sos/report/plugins/ovn_central.py
+++ b/sos/report/plugins/ovn_central.py
@@ -16,6 +16,7 @@ from sos.report.plugins import (
)
import json
import os
+import re
class OVNCentral(Plugin):
@@ -25,6 +26,26 @@ class OVNCentral(Plugin):
profiles = ('network', 'virt')
containers = ('ovn-dbs-bundle.*', 'ovn_cluster_north_db_server')
+ def _find_ovn_controller_sock(self):
+ _sfile = os.path.join(self.ovn_controller_sock_path,
+ self.ovn_controller_sock_regex)
+ if self._container_name:
+ res = self.exec_cmd("ls %s" % self.ovn_controller_sock_path,
+ container=self._container_name)
+ if res['status'] != 0 or '\n' not in res['output']:
+ self._log_error(
+ "Could not retrieve ovn_controller socket path "
+ "from container %s" % self._container_name
+ )
+ else:
+ pattern = re.compile(self.ovn_controller_sock_regex)
+ for filename in res['output'].split('\n'):
+ if pattern.match(filename):
+ return os.path.join(self.ovn_controller_sock_path,
+ filename)
+ # File not found, return the regex full path
+ return _sfile
+
def get_tables_from_schema(self, filename, skip=[]):
if self._container_name:
cmd = "cat %s" % filename
@@ -89,6 +110,8 @@ class OVNCentral(Plugin):
else:
self.add_copy_spec("/var/log/ovn/*.log")
+ ovn_controller_sock_path = self._find_ovn_controller_sock()
+
# ovsdb nb/sb cluster status commands
self.add_cmd_output(
[
@@ -96,7 +119,9 @@ class OVNCentral(Plugin):
self.ovn_nbdb_sock_path),
'ovs-appctl -t {} cluster/status OVN_Southbound'.format(
self.ovn_sbdb_sock_path),
- 'ovn-appctl -t ovn-northd status'
+ 'ovn-appctl -t ovn-northd status',
+ 'ovn-appctl -t {} connection-status'.format(
+ ovn_controller_sock_path),
],
foreground=True, container=self._container_name, timeout=30
)
@@ -165,6 +190,8 @@ class RedHatOVNCentral(OVNCentral, RedHatPlugin):
packages = ('openvswitch-ovn-central', 'ovn.*-central', )
ovn_nbdb_sock_path = '/var/run/openvswitch/ovnnb_db.ctl'
ovn_sbdb_sock_path = '/var/run/openvswitch/ovnsb_db.ctl'
+ ovn_controller_sock_path = '/var/run/openvswitch'
+ ovn_controller_sock_regex = 'ovn-controller.*.ctl'
class DebianOVNCentral(OVNCentral, DebianPlugin, UbuntuPlugin):
@@ -172,3 +199,5 @@ class DebianOVNCentral(OVNCentral, DebianPlugin, UbuntuPlugin):
packages = ('ovn-central', )
ovn_nbdb_sock_path = '/var/run/ovn/ovnnb_db.ctl'
ovn_sbdb_sock_path = '/var/run/ovn/ovnsb_db.ctl'
+ ovn_controller_sock_path = '/var/run/ovn'
+ ovn_controller_sock_regex = 'ovn-controller.*.ctl'