diff options
-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): |