aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Royo <froyo@redhat.com>2023-03-23 16:18:30 +0100
committerJake Hunsaker <jhunsake@redhat.com>2023-03-24 09:46:02 -0400
commita9e034740a483cbc086c607e29cd4076eff6227f (patch)
tree177ea23b743d6531e3820bfda0ece09b1dfb5536
parentd5d8c216810bcdd7065da9b90d6fe671618cba7e (diff)
downloadsos-a9e034740a483cbc086c607e29cd4076eff6227f.tar.gz
[ovn_central] add command ovn-appctl debug/chassis-features-list
The upcoming u/s OVN release will introduce a new command called 'debug/chassis-features-list', this patch add to the ovn_central plugin's list of commands, in order to promptly obtain this information. Note that in case the OVN version doesn't support this command, the plugin will not crash but instead save as output 'not a valid command' msg. Also a small refactor has been carried out in terms of reuse, for function _find_sock, as ovn-appctl commands for northd service need to run over specific socket. Signed-off-by: Fernando Royo <froyo@redhat.com>
-rw-r--r--sos/report/plugins/ovn_central.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
index 924880a3..e6a396ce 100644
--- a/sos/report/plugins/ovn_central.py
+++ b/sos/report/plugins/ovn_central.py
@@ -26,23 +26,20 @@ 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)
+ def _find_sock(self, path, regex_name):
+ _sfile = os.path.join(path, regex_name)
if self._container_name:
- res = self.exec_cmd("ls %s" % self.ovn_controller_sock_path,
- container=self._container_name)
+ res = self.exec_cmd("ls %s" % 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)
+ pattern = re.compile(regex_name)
for filename in res['output'].split('\n'):
if pattern.match(filename):
- return os.path.join(self.ovn_controller_sock_path,
- filename)
+ return os.path.join(path, filename)
# File not found, return the regex full path
return _sfile
@@ -110,7 +107,11 @@ class OVNCentral(Plugin):
else:
self.add_copy_spec("/var/log/ovn/*.log")
- ovn_controller_sock_path = self._find_ovn_controller_sock()
+ ovn_controller_sock_path = self._find_sock(
+ self.ovn_sock_path, self.ovn_controller_sock_regex)
+
+ northd_sock_path = self._find_sock(self.ovn_sock_path,
+ self.ovn_northd_sock_regex)
# ovsdb nb/sb cluster status commands
self.add_cmd_output(
@@ -119,7 +120,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 {} status'.format(northd_sock_path),
+ 'ovn-appctl -t {} debug/chassis-features-list'.format(
+ northd_sock_path),
'ovn-appctl -t {} connection-status'.format(
ovn_controller_sock_path),
],
@@ -192,8 +195,9 @@ 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_sock_path = '/var/run/openvswitch'
ovn_controller_sock_regex = 'ovn-controller.*.ctl'
+ ovn_northd_sock_regex = 'ovn-northd.*.ctl'
class DebianOVNCentral(OVNCentral, DebianPlugin, UbuntuPlugin):
@@ -201,5 +205,6 @@ 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_sock_path = '/var/run/ovn'
ovn_controller_sock_regex = 'ovn-controller.*.ctl'
+ ovn_northd_sock_regex = 'ovn-northd.*.ctl'