Skip to content

Commit

Permalink
hotfix: get pool member status
Browse files Browse the repository at this point in the history
  • Loading branch information
ederson.brilhante committed Nov 18, 2015
1 parent 23f2c88 commit a764c40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 9 additions & 6 deletions networkapi/api_pools/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def get_poolmember_state(servers_pools):
if not any_eqpt:
log.error('All equipments is in maintenance(Pool:%s'%pool_name)
raise exceptions.AllEquipamentMaintenance(pool_name)

ps = {}
status = {}
for lb in load_balance:
Expand All @@ -641,11 +641,14 @@ def get_poolmember_state(servers_pools):
ps[pool_id][member_id].append(st)
status[pool_id][member_id] = st

if len(ps[pool_id][member_id])>1:
if ps[pool_id][member_id][idx_m] != ps[pool_id][member_id][idx_m-1]:
msg = load_balance[lb]['pools_members'][idx][idx_m]['address']+':'+load_balance[lb]['pools_members'][idx][idx_m]['port']
log('The poolmember <<%s>> has states different in equipments.'%msg)
raise exceptions.DiffStatesEquipament(msg)
# Verify diff state of pool member in eqpts
log.info(ps)
for idx in ps:
for idx_m in ps[idx]:
if len(set(ps[idx][idx_m])) > 1:
msg = 'There are states differents in equipments.'
log.error(msg)
raise exceptions.DiffStatesEquipament(msg)
return status

def manager_pools(request):
Expand Down
5 changes: 4 additions & 1 deletion networkapi/plugins/F5/poolmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def setStates(self, pools):
pools['pools_members'],
pools['pools_members_session_state'])

@util.transation
#@util.transation
def getStates(self, pools):
self._lb._channel.System.Session.start_transaction()
try:
monitors = self._lb._channel.LocalLB.Pool.get_member_monitor_status(
pools['pools_name'],
Expand All @@ -89,8 +90,10 @@ def getStates(self, pools):
pools['pools_name'],
pools['pools_members'])
except Exception, e:
self._lb._channel.System.Session.rolback_transaction()
raise e
else:
self._lb._channel.System.Session.submit_transaction()
status_pools = []
for p, pool in enumerate(monitors):
status = []
Expand Down

0 comments on commit a764c40

Please sign in to comment.