Skip to content

Commit 2534f23

Browse files
committed
use the pool-id address and port to update the member
1 parent 3a2c5fc commit 2534f23

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

f5lbaasdriver/v2/bigip/plugin_rpc.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,22 +329,39 @@ def pool_destroyed(self, context, pool_id=None):
329329
@log_helpers.log_method_call
330330
def update_member_status_in_batch(self, context, members=[]):
331331
"""Agent confirmations hook to update member status in batch."""
332-
LOG.info('before update status in batch %d', len(members))
332+
length = len(members)
333+
LOG.debug('before updating status in batch %d', length)
333334
for member in members:
334335
try:
335-
LOG.info('member is %s %s.', member['id'], member['state'])
336+
pool_id = member['pool_id']
337+
address = member['address']
338+
port = member['protocol_port']
339+
status = member['state']
340+
model = models.MemberV2
341+
342+
query = self.driver.plugin.db._model_query(
343+
context, model).filter(
344+
model.pool_id == pool_id,
345+
model.address == address,
346+
model.protocol_port == port)
347+
348+
resource = query.one()
349+
if not resource:
350+
LOG.debug("no resource found.")
351+
continue
352+
336353
self.driver.plugin.db.update_status(
337354
context,
338-
models.MemberV2,
339-
member['id'],
355+
model,
356+
resource.id,
340357
None,
341-
member['state']
358+
status
342359
)
343360
# we only deal with Not found exception and skip all the others
344-
except q_exc.NotFound:
345-
LOG.warning('member %s not found.', member['id'])
346-
LOG.info('end of update status in batch.')
347-
361+
except Exception as e:
362+
LOG.error('Exception: update_pool_status_in_batch: %s',
363+
e.message)
364+
LOG.debug('end updating status in batch %d.', length)
348365
return
349366

350367
@log_helpers.log_method_call

0 commit comments

Comments
 (0)