Throttle collectd OVS interface plugin startup wait log

This update turns a flooding failure log into a single
waiting log while the collectd OVS interface plugin
initialization sequence waits for a running ovs daemon.

A few pep8 long line warning are fixed.

Test Plan:

PASS: Verify plugin behavior of compute system install without Openstack
PASS: Verify plugin behavior in AIO-SX with Openstack
PASS: Verify plugin failure handling and recovery with Openstack
             Note: the ovs-vswitch pmon conf file was changed to allow
             process failure recovery to verify the plugin was able to
             handle transition from not running/waiting to running once
             process started.
PASS: Verify plugin failure handling when ovs-vswitchd process fails.
             Note: pmond does not try and recover and the following
             collectd log is produced every 10 seconds.
             'err ovs interface plugin failed to dump ports br-phy1 desc'

Change-Id: I95d308f771ebabc77dbeb5113feae283538d37d3
Closes-Bug: 1855597
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2020-01-31 19:10:57 -05:00
parent 02b1d056ee
commit 4ab570a850
1 changed files with 22 additions and 12 deletions

View File

@ -41,10 +41,10 @@
# 0 or 0% percent used - all interfaces for that port are Down
#
# For example:
# x will be 0 when all interfaces of that port are Down.
# x will be 50 when one interface of the bond which contains two interfaces is down.
# x will be 66.7 when two of the bond which contains three interfaces are down.
# x will be 100 when all interfaces of that port are up.
# x is 0 when all interfaces of that port are Down.
# x is 50 when one interface of a two interface bond is down.
# x is 66.7 when two of a three interface bond is down.
# x is 100 when all interfaces of that port are up.
#
############################################################################
@ -56,6 +56,7 @@ import plugin_common as pc
from oslo_concurrency import processutils
from fm_api import constants as fm_constants
from fm_api import fm_api
import tsconfig.tsconfig as tsc
# Fault manager API Object
api = fm_api.FaultAPIsV2()
@ -219,7 +220,7 @@ class InterfaceObject:
return True
def manage_interface_alarm(self, current_state):
"""raise or clear interface alarm based on previous state and current state"""
"""raise or clear interface alarm based on previous/current state"""
if current_state != self.state:
if current_state == LINK_UP:
@ -858,7 +859,9 @@ def init_func():
if obj.init_ready() is False:
return 0
obj.hostname = obj.gethostname()
# Only runs on worker nodes
if 'worker' not in tsc.subfunctions:
return 0
# Check whether this host is openstack worker node or not
# OVS and OVSDPDK will only run on openstack worker node
@ -873,15 +876,22 @@ def init_func():
if count == 1 and pid:
# /var/run/openvswitch/ovs-vswitchd.43.ctl
global OVS_VSWITCHD_SOCKET
OVS_VSWITCHD_SOCKET = "".join([OVS_VSWITCHD_PATH, ".", pid, ".ctl"])
OVS_VSWITCHD_SOCKET = \
"".join([OVS_VSWITCHD_PATH, ".", pid, ".ctl"])
obj.init_done = True
obj.hostname = obj.gethostname()
collectd.info("%s initialization complete" % PLUGIN)
else:
obj.error_logged = False
elif obj.error_logged is False:
collectd.info("%s failed to retrieve pid for ovs-vswitchd in "
"file /var/run/openvswitch/ovs-vswitchd.pid" % PLUGIN)
else:
collectd.info("%s failed to initial because pid file "
"for ovs-vswitchd doesn't exist" % PLUGIN)
"file /var/run/openvswitch/ovs-vswitchd.pid" %
PLUGIN)
obj.error_logged = True
elif obj.error_logged is False:
collectd.info("%s waiting for ovs-vswitchd to be running" % PLUGIN)
obj.error_logged = True
return 0