Skip to content

Commit a146945

Browse files
authored
Merge pull request #1109 from jikui/base
Base
2 parents 1e14673 + 2534f23 commit a146945

1 file changed

Lines changed: 39 additions & 2 deletions

File tree

f5lbaasdriver/v2/bigip/plugin_rpc.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@
2929
from neutron_lib.api.definitions import portbindings
3030
from neutron_lib import constants as neutron_const
3131
from neutron_lib import exceptions as q_exc
32-
3332
from oslo_log import helpers as log_helpers
3433
from oslo_log import log as logging
3534

36-
3735
LOG = logging.getLogger(__name__)
3836

3937

@@ -179,6 +177,7 @@ def get_active_loadbalancers(self, context, env, group=None, host=None):
179177
}
180178
)
181179
if host:
180+
LOG.debug('get active lb with host %s' % host)
182181
return [lb for lb in loadbalancers if lb['agent_host'] == host]
183182
else:
184183
return loadbalancers
@@ -327,6 +326,44 @@ def pool_destroyed(self, context, pool_id=None):
327326
"""Agent confirmation hook that pool has been destroyed."""
328327
self.driver.plugin.db.delete_pool(context, pool_id)
329328

329+
@log_helpers.log_method_call
330+
def update_member_status_in_batch(self, context, members=[]):
331+
"""Agent confirmations hook to update member status in batch."""
332+
length = len(members)
333+
LOG.debug('before updating status in batch %d', length)
334+
for member in members:
335+
try:
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+
353+
self.driver.plugin.db.update_status(
354+
context,
355+
model,
356+
resource.id,
357+
None,
358+
status
359+
)
360+
# we only deal with Not found exception and skip all the others
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)
365+
return
366+
330367
@log_helpers.log_method_call
331368
def update_member_status(self, context, member_id=None,
332369
provisioning_status=None,

0 commit comments

Comments
 (0)