aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Royo <froyo@redhat.com>2022-10-28 13:49:50 +0200
committerJake Hunsaker <jhunsake@redhat.com>2022-10-31 09:27:15 -0400
commit3aabbd0969086d8550fcd7f80fec6031209fd3b2 (patch)
treeefbd0d5ac77295a58222bf5c791d4f12fd67ac45
parentd5cb9163fd09faaa2e2993645f85f6cd83289a4a (diff)
downloadsos-3aabbd0969086d8550fcd7f80fec6031209fd3b2.tar.gz
[ovn_central] Add commands to get OVN DBs stats
In order to automate the parsing of the plugin output files, by systems could only read file contentit, seems useful to add an output cmd file where data, such as the size or permissions, of the OVN DBs is directly available. This patch modifies the current behaviour to copy the db files of each OVN DB to create a file containing the ls -lan output of the files. The list of possible locations of these *.db files is maintained for backwards compatibility but it has been necessary to iterate over them to only obtain the information file of those that really exist. Signed-off-by: Fernando Royo <froyo@redhat.com>
-rw-r--r--sos/report/plugins/ovn_central.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
index 4f629758..756e5580 100644
--- a/sos/report/plugins/ovn_central.py
+++ b/sos/report/plugins/ovn_central.py
@@ -170,15 +170,20 @@ class OVNCentral(Plugin):
self.add_copy_spec("/etc/sysconfig/ovn-northd")
ovs_dbdir = os.environ.get('OVS_DBDIR')
- for dbfile in ['ovnnb_db.db', 'ovnsb_db.db']:
- self.add_copy_spec([
- self.path_join('/var/lib/openvswitch/ovn', dbfile),
- self.path_join('/usr/local/etc/openvswitch', dbfile),
- self.path_join('/etc/openvswitch', dbfile),
- self.path_join('/var/lib/openvswitch', dbfile),
- self.path_join('/var/lib/ovn/etc', dbfile),
- self.path_join('/var/lib/ovn', dbfile)
- ])
+ for dbfile in ["ovnnb_db.db", "ovnsb_db.db"]:
+ for path in [
+ "/var/lib/openvswitch/ovn",
+ "/usr/local/etc/openvswitch",
+ "/etc/openvswitch",
+ "/var/lib/openvswitch",
+ "/var/lib/ovn/etc",
+ "/var/lib/ovn",
+ ]:
+ dbfilepath = self.path_join(path, dbfile)
+ if os.path.exists(dbfilepath):
+ self.add_copy_spec(dbfilepath)
+ self.add_cmd_output(
+ "ls -lan %s" % dbfilepath, foreground=True)
if ovs_dbdir:
self.add_copy_spec(self.path_join(ovs_dbdir, dbfile))