|
29 | 29 | from neutron_lib.api.definitions import portbindings |
30 | 30 | from neutron_lib import constants as neutron_const |
31 | 31 | from neutron_lib import exceptions as q_exc |
32 | | - |
33 | 32 | from oslo_log import helpers as log_helpers |
34 | 33 | from oslo_log import log as logging |
35 | 34 |
|
36 | | - |
37 | 35 | LOG = logging.getLogger(__name__) |
38 | 36 |
|
39 | 37 |
|
@@ -179,6 +177,7 @@ def get_active_loadbalancers(self, context, env, group=None, host=None): |
179 | 177 | } |
180 | 178 | ) |
181 | 179 | if host: |
| 180 | + LOG.debug('get active lb with host %s' % host) |
182 | 181 | return [lb for lb in loadbalancers if lb['agent_host'] == host] |
183 | 182 | else: |
184 | 183 | return loadbalancers |
@@ -327,6 +326,27 @@ def pool_destroyed(self, context, pool_id=None): |
327 | 326 | """Agent confirmation hook that pool has been destroyed.""" |
328 | 327 | self.driver.plugin.db.delete_pool(context, pool_id) |
329 | 328 |
|
| 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 | + |
330 | 350 | @log_helpers.log_method_call |
331 | 351 | def update_member_status(self, context, member_id=None, |
332 | 352 | provisioning_status=None, |
|
0 commit comments