Skip to content

Commit 3a2c5fc

Browse files
committed
add a new member batch operation rpc
1 parent c892b65 commit 3a2c5fc

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

f5lbaasdriver/v2/bigip/plugin_rpc.py

Lines changed: 22 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,27 @@ 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+
LOG.info('before update status in batch %d', len(members))
333+
for member in members:
334+
try:
335+
LOG.info('member is %s %s.', member['id'], member['state'])
336+
self.driver.plugin.db.update_status(
337+
context,
338+
models.MemberV2,
339+
member['id'],
340+
None,
341+
member['state']
342+
)
343+
# 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+
348+
return
349+
330350
@log_helpers.log_method_call
331351
def update_member_status(self, context, member_id=None,
332352
provisioning_status=None,

0 commit comments

Comments
 (0)