Merge "Ignore LB not existed when delete member pool"

This commit is contained in:
Zuul 2019-09-13 03:59:29 +00:00 committed by Gerrit Code Review
commit c19f2de68e
2 changed files with 12 additions and 7 deletions

View File

@ -341,10 +341,11 @@ class LoadBalancerDriver(base.DriverBase):
# loadbalancer status will be checked before deleting lb member
# request is sent out. If loadbalancer keeps unready till waiting
# timeout, exception will be raised to fail member_remove.
res = self._wait_for_lb_ready(lb_id)
if not res:
msg = 'Loadbalancer %s is not ready.' % lb_id
raise exception.Error(msg)
res = self._wait_for_lb_ready(lb_id, ignore_not_found=True)
# res = self._wait_for_lb_ready(lb_id)
# if not res:
# msg = 'Loadbalancer %s is not ready.' % lb_id
# raise exception.Error(msg)
self.oc().pool_member_delete(pool_id, member_id)
except (exception.InternalError, exception.Error) as ex:
LOG.exception('Failed in removing member %(m)s from pool %(p)s: '

View File

@ -667,7 +667,8 @@ class TestOctaviaLBaaSDriver(base.SenlinTestCase):
self.assertTrue(res)
self.oc.pool_member_delete.assert_called_once_with(pool_id, member_id)
self.lb_driver._wait_for_lb_ready.assert_has_calls(
[mock.call(lb_id), mock.call(lb_id, ignore_not_found=True)])
[mock.call(lb_id, ignore_not_found=True),
mock.call(lb_id, ignore_not_found=True)])
def test_member_remove_lb_unready_for_member_delete(self):
self.lb_driver._wait_for_lb_ready = mock.Mock()
@ -675,7 +676,9 @@ class TestOctaviaLBaaSDriver(base.SenlinTestCase):
res = self.lb_driver.member_remove('LB_ID', 'POOL_ID', 'MEMBER_ID')
self.assertFalse(res)
self.lb_driver._wait_for_lb_ready.assert_called_once_with('LB_ID')
self.lb_driver._wait_for_lb_ready.assert_has_calls(
[mock.call('LB_ID', ignore_not_found=True),
mock.call('LB_ID', ignore_not_found=True)])
def test_member_remove_member_delete_failed(self):
self.lb_driver._wait_for_lb_ready = mock.Mock()
@ -696,4 +699,5 @@ class TestOctaviaLBaaSDriver(base.SenlinTestCase):
res = self.lb_driver.member_remove('LB_ID', 'POOL_ID', 'MEMBER_ID')
self.assertIsNone(res)
self.lb_driver._wait_for_lb_ready.assert_has_calls(
[mock.call('LB_ID'), mock.call('LB_ID', ignore_not_found=True)])
[mock.call('LB_ID', ignore_not_found=True),
mock.call('LB_ID', ignore_not_found=True)])