Blame SOURCES/sos-bz2043488-ovn-proper-package-enablement.patch

819553
From 210b83e1d1164d29b1f6198675b8b596c4af8336 Mon Sep 17 00:00:00 2001
819553
From: Daniel Alvarez Sanchez <dalvarez@redhat.com>
819553
Date: Thu, 20 Jan 2022 12:58:44 +0100
819553
Subject: [PATCH] [ovn_central] Account for Red Hat ovn package naming
819553
819553
Previous ovn packages were 'ovn2xxx' and now they have
819553
been renamed to 'ovn-2xxx'. This causes sos tool to not
819553
recognize that the packages are installed and it won't
819553
collect the relevant data.
819553
819553
This patch is changing the match to be compatible
819553
with the previous and newer naming conventions.
819553
819553
Signed-off-by: Daniel Alvarez Sanchez <dalvarez@redhat.com>
819553
---
819553
 sos/report/plugins/ovn_central.py | 2 +-
819553
 sos/report/plugins/ovn_host.py    | 2 +-
819553
 2 files changed, 2 insertions(+), 2 deletions(-)
819553
819553
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
819553
index ddbf288da..0f947d4c5 100644
819553
--- a/sos/report/plugins/ovn_central.py
819553
+++ b/sos/report/plugins/ovn_central.py
819553
@@ -147,7 +147,7 @@ def setup(self):
819553
 
819553
 class RedHatOVNCentral(OVNCentral, RedHatPlugin):
819553
 
819553
-    packages = ('openvswitch-ovn-central', 'ovn2.*-central', )
819553
+    packages = ('openvswitch-ovn-central', 'ovn.*-central', )
819553
     ovn_sbdb_sock_path = '/var/run/openvswitch/ovnsb_db.ctl'
819553
 
819553
 
819553
diff --git a/sos/report/plugins/ovn_host.py b/sos/report/plugins/ovn_host.py
819553
index 78604a15a..25c38cccc 100644
819553
--- a/sos/report/plugins/ovn_host.py
819553
+++ b/sos/report/plugins/ovn_host.py
819553
@@ -55,7 +55,7 @@ def check_enabled(self):
819553
 
819553
 class RedHatOVNHost(OVNHost, RedHatPlugin):
819553
 
819553
-    packages = ('openvswitch-ovn-host', 'ovn2.*-host', )
819553
+    packages = ('openvswitch-ovn-host', 'ovn.*-host', )
819553
 
819553
 
819553
 class DebianOVNHost(OVNHost, DebianPlugin, UbuntuPlugin):
819553
From 21fc376d97a5f74743e2b7cf7069349e874b979e Mon Sep 17 00:00:00 2001
819553
From: Hemanth Nakkina <hemanth.nakkina@canonical.com>
819553
Date: Fri, 4 Feb 2022 07:57:59 +0530
819553
Subject: [PATCH] [ovn-central] collect NB/SB ovsdb-server cluster status
819553
819553
Add commands to collect cluster status of Northbound and
819553
Southbound ovsdb servers.
819553
819553
Resolves: #2840
819553
819553
Signed-off-by: Hemanth Nakkina hemanth.nakkina@canonical.com
819553
---
819553
 sos/report/plugins/ovn_central.py | 13 ++++++++++++-
819553
 1 file changed, 12 insertions(+), 1 deletion(-)
819553
819553
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
819553
index 0f947d4c5..2f0438df3 100644
819553
--- a/sos/report/plugins/ovn_central.py
819553
+++ b/sos/report/plugins/ovn_central.py
819553
@@ -84,6 +84,14 @@ def setup(self):
819553
         else:
819553
             self.add_copy_spec("/var/log/ovn/*.log")
819553
 
819553
+        # ovsdb nb/sb cluster status commands
819553
+        ovsdb_cmds = [
819553
+            'ovs-appctl -t {} cluster/status OVN_Northbound'.format(
819553
+                self.ovn_nbdb_sock_path),
819553
+            'ovs-appctl -t {} cluster/status OVN_Southbound'.format(
819553
+                self.ovn_sbdb_sock_path),
819553
+        ]
819553
+
819553
         # Some user-friendly versions of DB output
819553
         nbctl_cmds = [
819553
             'ovn-nbctl show',
819553
@@ -109,7 +117,8 @@ def setup(self):
819553
 
819553
         self.add_database_output(nb_tables, nbctl_cmds, 'ovn-nbctl')
819553
 
819553
-        cmds = nbctl_cmds
819553
+        cmds = ovsdb_cmds
819553
+        cmds += nbctl_cmds
819553
 
819553
         # Can only run sbdb commands if we are the leader
819553
         co = {'cmd': "ovs-appctl -t {} cluster/status OVN_Southbound".
819553
@@ -148,10 +157,12 @@ def setup(self):
819553
 class RedHatOVNCentral(OVNCentral, RedHatPlugin):
819553
 
819553
     packages = ('openvswitch-ovn-central', 'ovn.*-central', )
819553
+    ovn_nbdb_sock_path = '/var/run/openvswitch/ovnnb_db.ctl'
819553
     ovn_sbdb_sock_path = '/var/run/openvswitch/ovnsb_db.ctl'
819553
 
819553
 
819553
 class DebianOVNCentral(OVNCentral, DebianPlugin, UbuntuPlugin):
819553
 
819553
     packages = ('ovn-central', )
819553
+    ovn_nbdb_sock_path = '/var/run/ovn/ovnnb_db.ctl'
819553
     ovn_sbdb_sock_path = '/var/run/ovn/ovnsb_db.ctl'
819553
From d0f9d507b0ec63c9e8f3e5d7b6507d9d0f97c038 Mon Sep 17 00:00:00 2001
819553
From: Jake Hunsaker <jhunsake@redhat.com>
819553
Date: Tue, 15 Feb 2022 16:24:47 -0500
819553
Subject: [PATCH] [runtimes] Allow container IDs to be used with
819553
 `container_exists()`
819553
819553
As container runtimes can interchange container names and container IDs,
819553
sos should also allow the use of container IDs when checking for the
819553
presence of a given container.
819553
819553
In particular, this change unblocks the use of `Plugin.exec_cmd()` when
819553
used in conjunction with `Plugin.get_container_by_name()` to pick a
819553
container based on a provided regex that the container name may match.
819553
819553
Related: #2856
819553
819553
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
819553
---
819553
 sos/policies/runtimes/__init__.py | 17 +++++++++++++++++
819553
 sos/report/plugins/__init__.py    |  6 +++---
819553
 2 files changed, 20 insertions(+), 3 deletions(-)
819553
819553
diff --git a/sos/policies/runtimes/__init__.py b/sos/policies/runtimes/__init__.py
819553
index 5ac673544..d28373496 100644
819553
--- a/sos/policies/runtimes/__init__.py
819553
+++ b/sos/policies/runtimes/__init__.py
819553
@@ -147,6 +147,23 @@ def get_volumes(self):
819553
                     vols.append(ent[-1])
819553
         return vols
819553
 
819553
+    def container_exists(self, container):
819553
+        """Check if a given container ID or name exists on the system from the
819553
+        perspective of the container runtime.
819553
+
819553
+        Note that this will only check _running_ containers
819553
+
819553
+        :param container:       The name or ID of the container
819553
+        :type container:        ``str``
819553
+
819553
+        :returns:               True if the container exists, else False
819553
+        :rtype:                 ``bool``
819553
+        """
819553
+        for _contup in self.containers:
819553
+            if container in _contup:
819553
+                return True
819553
+        return False
819553
+
819553
     def fmt_container_cmd(self, container, cmd, quotecmd):
819553
         """Format a command to run inside a container using the runtime
819553
 
819553
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
819553
index 2988be089..cc5cb65bc 100644
819553
--- a/sos/report/plugins/__init__.py
819553
+++ b/sos/report/plugins/__init__.py
819553
@@ -2593,7 +2593,7 @@ def container_exists(self, name):
819553
         """If a container runtime is present, check to see if a container with
819553
         a given name is currently running
819553
 
819553
-        :param name:    The name of the container to check presence of
819553
+        :param name:    The name or ID of the container to check presence of
819553
         :type name: ``str``
819553
 
819553
         :returns: ``True`` if `name` exists, else ``False``
819553
@@ -2601,8 +2601,8 @@ def container_exists(self, name):
819553
         """
819553
         _runtime = self._get_container_runtime()
819553
         if _runtime is not None:
819553
-            con = _runtime.get_container_by_name(name)
819553
-            return con is not None
819553
+            return (_runtime.container_exists(name) or
819553
+                    _runtime.get_container_by_name(name) is not None)
819553
         return False
819553
 
819553
     def get_all_containers_by_regex(self, regex, get_all=False):
819553
819553
From de9b020a72d1ceda39587db4c6d5acf72cd90da2 Mon Sep 17 00:00:00 2001
819553
From: Fernando Royo <froyo@redhat.com>
819553
Date: Tue, 15 Feb 2022 10:00:38 +0100
819553
Subject: [PATCH] [ovn_central] Rename container responsable of Red Hat
819553
 ovn_central plugin
819553
819553
ovn_central plugin is running by container with
819553
name 'ovn-dbs-bundle*', a typo has been identified and
819553
this cause plugin ovn_central not enabled by default as it
819553
does not recognize any container responsible of this.
819553
819553
This patch fix this container name match, searching schema db
819553
keeping backward compatibility with openvswitch.
819553
---
819553
 sos/report/plugins/ovn_central.py | 23 ++++++++++++-----------
819553
 1 file changed, 12 insertions(+), 11 deletions(-)
819553
819553
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
819553
index 2f0438df..2f34bff0 100644
819553
--- a/sos/report/plugins/ovn_central.py
819553
+++ b/sos/report/plugins/ovn_central.py
819553
@@ -24,7 +24,7 @@ class OVNCentral(Plugin):
819553
     short_desc = 'OVN Northd'
819553
     plugin_name = "ovn_central"
819553
     profiles = ('network', 'virt')
819553
-    containers = ('ovs-db-bundle.*',)
819553
+    containers = ('ovn-dbs-bundle.*',)
819553
 
819553
     def get_tables_from_schema(self, filename, skip=[]):
819553
         if self._container_name:
819553
@@ -66,7 +66,7 @@ class OVNCentral(Plugin):
819553
             cmds.append('%s list %s' % (ovn_cmd, table))
819553
 
819553
     def setup(self):
819553
-        self._container_name = self.get_container_by_name('ovs-dbs-bundle.*')
819553
+        self._container_name = self.get_container_by_name(self.containers[0])
819553
 
819553
         ovs_rundir = os.environ.get('OVS_RUNDIR')
819553
         for pidfile in ['ovnnb_db.pid', 'ovnsb_db.pid', 'ovn-northd.pid']:
819553
@@ -110,12 +110,11 @@ class OVNCentral(Plugin):
819553
             'ovn-sbctl get-connection',
819553
         ]
819553
 
819553
-        schema_dir = '/usr/share/openvswitch'
819553
-
819553
-        nb_tables = self.get_tables_from_schema(self.path_join(
819553
-            schema_dir, 'ovn-nb.ovsschema'))
819553
-
819553
-        self.add_database_output(nb_tables, nbctl_cmds, 'ovn-nbctl')
819553
+        # backward compatibility
819553
+        for path in ['/usr/share/openvswitch', '/usr/share/ovn']:
819553
+            nb_tables = self.get_tables_from_schema(self.path_join(
819553
+                path, 'ovn-nb.ovsschema'))
819553
+            self.add_database_output(nb_tables, nbctl_cmds, 'ovn-nbctl')
819553
 
819553
         cmds = ovsdb_cmds
819553
         cmds += nbctl_cmds
819553
@@ -125,9 +124,11 @@ class OVNCentral(Plugin):
819553
               format(self.ovn_sbdb_sock_path),
819553
               "output": "Leader: self"}
819553
         if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=co)):
819553
-            sb_tables = self.get_tables_from_schema(self.path_join(
819553
-                schema_dir, 'ovn-sb.ovsschema'), ['Logical_Flow'])
819553
-            self.add_database_output(sb_tables, sbctl_cmds, 'ovn-sbctl')
819553
+            # backward compatibility
819553
+            for path in ['/usr/share/openvswitch', '/usr/share/ovn']:
819553
+                sb_tables = self.get_tables_from_schema(self.path_join(
819553
+                    path, 'ovn-sb.ovsschema'), ['Logical_Flow'])
819553
+                self.add_database_output(sb_tables, sbctl_cmds, 'ovn-sbctl')
819553
             cmds += sbctl_cmds
819553
 
819553
         # If OVN is containerized, we need to run the above commands inside
819553
-- 
819553
2.34.1
819553