From d2be21de56bd5e51496d564d178b1a83056b23d4 Mon Sep 17 00:00:00 2001 From: Periyasamy Palanisamy Date: Tue, 15 Aug 2023 11:47:20 +0200 Subject: [PATCH] Collect ovn logs as much as possible The sosreport limits to collect logs at maximum of 25 MB in a given collection passed into add_copy_spec method. so this may lead into logs wouldn't have fully collected when user collected sos report without --all-logs option. Hence this commit ensures logs and dbs collected as much as possible when --all-logs option is not specified. Signed-off-by: Periyasamy Palanisamy --- sos/report/plugins/openshift_ovn.py | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/sos/report/plugins/openshift_ovn.py b/sos/report/plugins/openshift_ovn.py index 2d804e9ae5..a21649fbbb 100644 --- a/sos/report/plugins/openshift_ovn.py +++ b/sos/report/plugins/openshift_ovn.py @@ -20,19 +20,33 @@ class OpenshiftOVN(Plugin, RedHatPlugin): profiles = ('openshift',) def setup(self): + all_logs = self.get_option("all_logs") + self.add_copy_spec([ "/var/lib/ovn/etc/ovnnb_db.db", "/var/lib/ovn/etc/ovnsb_db.db", - "/var/lib/openvswitch/etc/keys", - "/var/log/openvswitch/libreswan.log", - "/var/log/openvswitch/ovs-monitor-ipsec.log" - ]) - # Collect ovn interconnect specific files if exists. + "/var/lib/openvswitch/etc/keys" + ], sizelimit=300) + + # Collect ovn interconnect specific db files if exists. self.add_copy_spec([ "/var/lib/ovn-ic/etc/ovnnb_db.db", - "/var/lib/ovn-ic/etc/ovnsb_db.db", - "/var/lib/ovn-ic/etc/libovsdb*log*" - ]) + "/var/lib/ovn-ic/etc/ovnsb_db.db" + ], sizelimit=300) + + # Collect ipsec logs for openvswitch and additionally libovsdb + # logs in case of ovn interconnect setup. + if not all_logs: + self.add_copy_spec([ + "/var/log/openvswitch/libreswan.log", + "/var/log/openvswitch/ovs-monitor-ipsec.log" + ]) + self.add_copy_spec([ + "/var/lib/ovn-ic/etc/libovsdb.log", + "/var/lib/ovn-ic/etc/libovsdb*log.gz" + ], sizelimit=100) + else: + self.add_copy_spec("/var/lib/ovn-ic/etc/libovsdb*log*") # The ovn cluster/status is not valid anymore for interconnect setup. self.add_cmd_output([