diff options
author | Daniel Alvarez <dalvarez@redhat.com> | 2019-07-25 11:42:16 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-09-11 16:22:12 +0100 |
commit | a895bf4096f1dbd71c9dbd4defb47783f4ef9840 (patch) | |
tree | 51c5d5d8d697c6a805785c2480f5407f5eac1b9b | |
parent | 3c842046e9c4c5b371566347f51e5e242daf4f8d (diff) | |
download | sos-a895bf4096f1dbd71c9dbd4defb47783f4ef9840.tar.gz |
[ovn_host] Add support for containerized setups
Prior to this patch, ovn_host was disabled on containerized
setups due to the fact that ovn-controller package is not
installed in the host.
This patch fixes it by checking if the ovn-controller process
is running.
Resolves: #1767
Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/ovn_host.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sos/plugins/ovn_host.py b/sos/plugins/ovn_host.py index ba35d87e..5225f010 100644 --- a/sos/plugins/ovn_host.py +++ b/sos/plugins/ovn_host.py @@ -12,6 +12,15 @@ import os from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +pidfile = 'ovn-controller.pid' +pid_paths = [ + '/var/lib/openvswitch/ovn', + '/usr/local/var/run/openvswitch', + '/var/run/openvswitch', + '/run/openvswitch' +] + + class OVNHost(Plugin): """ OVN Controller """ @@ -19,13 +28,6 @@ class OVNHost(Plugin): profiles = ('network', 'virt') def setup(self): - pidfile = 'ovn-controller.pid' - pid_paths = [ - '/var/lib/openvswitch/ovn', - '/usr/local/var/run/openvswitch', - '/var/run/openvswitch', - '/run/openvswitch' - ] if os.environ.get('OVS_RUNDIR'): pid_paths.append(os.environ.get('OVS_RUNDIR')) self.add_copy_spec([os.path.join(pp, pidfile) for pp in pid_paths]) @@ -40,6 +42,11 @@ class OVNHost(Plugin): self.add_journal(units="ovn-controller") + def check_enabled(self): + return (any([os.path.isfile( + os.path.join(pp, pidfile)) for pp in pid_paths]) or + super(OVNHost, self).check_enabled()) + class RedHatOVNHost(OVNHost, RedHatPlugin): |