Skip to content

Commit

Permalink
Fixing loadbalancer nodemgr code
Browse files Browse the repository at this point in the history
This fix changes the way nodemgr code iterates
over all pools. Currently its falsely iterating over
haproxy.conf, etc files instead of pool_ids

Change-Id: I463dd30d3afb00f7eb7dd9440e31c44def83e990
Closes-Bug: #1530200
  • Loading branch information
varun_lodaya committed Mar 2, 2016
1 parent 2efe77a commit 90b771e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/nodemgr/loadbalancer_stats.py
Expand Up @@ -3,17 +3,19 @@

from haproxy_stats import HaproxyStats
from vrouter.loadbalancer.ttypes import \
UveLoadbalancerTrace, UveLoadbalancer, UveLoadbalancerStats
UveLoadbalancerTrace, UveLoadbalancer, UveLoadbalancerStats

LB_BASE_DIR = '/var/lib/contrail/loadbalancer/'

class LoadbalancerStats(object):
def __init__(self):
self.driver = HaproxyStats()
try:
self.old_pool_uuids = os.listdir(LB_BASE_DIR)
except OSError:
self.old_pool_uuids = []
self.driver = HaproxyStats()
try:
haproxy_files = os.listdir(LB_BASE_DIR)
self.old_pool_uuids = [f.split('.')[0] for f in haproxy_files \
if f.endswith('conf')]
except OSError:
self.old_pool_uuids = []

def _uve_get_stats(self, stats):
obj_stats = UveLoadbalancerStats()
Expand Down Expand Up @@ -44,7 +46,9 @@ def _uve_get_member_stats(self, stats):

def _send_loadbalancer_uve(self):
try:
pool_uuids = os.listdir(LB_BASE_DIR)
haproxy_files = os.listdir(LB_BASE_DIR)
pool_uuids = [f.split('.')[0] for f in haproxy_files \
if f.endswith('conf')]
except OSError:
return

Expand Down

0 comments on commit 90b771e

Please sign in to comment.