Skip to content

Commit

Permalink
LBaaS member status reflected incorrectly
Browse files Browse the repository at this point in the history
This fix adds the missing _get_object_status API.
It also fixes the logic of the way plugin analyzes uves
If status of any requested member uve is ACTIVE, it
shows the member as ACTIVE, rather than checking the first
available member uve.

Change-Id: I459bf39dace912caa962214de2aec3f24a0bced2
Closes-Bug: #1560741
  • Loading branch information
varun_lodaya committed Mar 23, 2016
1 parent 182c96e commit e8c22f5
Showing 1 changed file with 23 additions and 0 deletions.
Expand Up @@ -42,6 +42,29 @@ def _get_member_pool_id(self, member):
pool_uuid = member.parent_uuid
return pool_uuid

def _get_object_status(self, member):
endpoint = "http://%s:%s" % (cfg.CONF.COLLECTOR.analytics_api_ip,
cfg.CONF.COLLECTOR.analytics_api_port)
analytics = analytics_client.Client(endpoint)
path = "/analytics/uves/service-instance/"
fqdn_uuid = "%s?cfilt=UveLoadbalancer" % member.parent_uuid
try:
lb_stats = analytics.request(path, fqdn_uuid)
member_stats = lb_stats['UveLoadbalancer']['member_stats']
except Exception:
member_stats = []

# In case of missing analytics, return ACTIVE
if not member_stats:
return constants.ACTIVE

for member_stat in member_stats:
if member_stat['uuid'] == member.uuid and \
member_stat['status'] == 'ACTIVE':
return member_stat['status']

return constants.DOWN

def make_dict(self, member, fields=None):
res = {'id': member.uuid,
'pool_id': member.parent_uuid,
Expand Down

0 comments on commit e8c22f5

Please sign in to comment.