diff options
author | Fernando Royo <froyo@redhat.com> | 2022-10-25 13:32:50 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-10-26 10:41:25 -0400 |
commit | 814c3283bdaa7b8a10ccea88cef40ac47005cf44 (patch) | |
tree | bdc85b6899e2cbbe2800278fdaea7625123545af | |
parent | 9b6de1e69bbb645f71cbc3006757b3e4c2c88970 (diff) | |
download | sos-814c3283bdaa7b8a10ccea88cef40ac47005cf44.tar.gz |
[ovn_central] Add support to OVN DBs clustering and non-clustered
Most of the output we get from the ovn_central plugin is obtained
by executing ovn-nbctl or ovn-sbctl commands on specifc container
on the controller node.
Until now for non-clustered environments (active/backup mode) the
container used was ovn-dbs-bundle-* (its name includes a variable
numeric id), but this container disappears when OVN DB clustered
is deployed, adding specific containers for the OVN NB DB cluster
and the OVN SB DB cluster.
This patch adds logic to identify if we are in front of an OVN DB
server running in clustered mode or not, by checking for the
existence of specific containers, otherwise it works as before.
-rw-r--r-- | sos/report/plugins/ovn_central.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py index 8c37580c..f5c1d581 100644 --- a/sos/report/plugins/ovn_central.py +++ b/sos/report/plugins/ovn_central.py @@ -23,7 +23,7 @@ class OVNCentral(Plugin): short_desc = 'OVN Northd' plugin_name = "ovn_central" profiles = ('network', 'virt') - containers = ('ovn-dbs-bundle.*',) + containers = ('ovn-dbs-bundle.*', 'ovn_cluster_north_db_server') def get_tables_from_schema(self, filename, skip=[]): if self._container_name: @@ -65,7 +65,13 @@ class OVNCentral(Plugin): cmds.append('%s list %s' % (ovn_cmd, table)) def setup(self): - self._container_name = self.get_container_by_name(self.containers[0]) + # check if env is a clustered or non-clustered one + if self.container_exists(self.containers[1]): + self._container_name = self.get_container_by_name( + self.containers[1]) + else: + self._container_name = self.get_container_by_name( + self.containers[0]) ovs_rundir = os.environ.get('OVS_RUNDIR') for pidfile in ['ovnnb_db.pid', 'ovnsb_db.pid', 'ovn-northd.pid']: |