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

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