Merge "Delete the "self" when call "_set_degraded" function"

This commit is contained in:
Jenkins 2016-08-10 07:46:08 +00:00 committed by Gerrit Code Review
commit 602f3a2304
2 changed files with 21 additions and 1 deletions

View File

@ -1479,7 +1479,7 @@ class LoadBalancerPluginv2(loadbalancerv2.LoadBalancerPluginBaseV2):
[ps["id"] for ps in lb_status["pools"]]):
lb_status["pools"].append(pool_status)
if self._is_degraded(curr_listener.default_pool):
self._set_degraded(self, listener_status, lb_status)
self._set_degraded(listener_status, lb_status)
members = curr_listener.default_pool.members
for curr_member in members:
if not curr_member.admin_state_up:

View File

@ -4191,6 +4191,26 @@ class LbaasStatusesTest(MemberTestBase):
self._assertNotDegraded(self._traverse_statuses(statuses,
listener='listener_HTTPS'))
def test_degraded_with_pool_error(self):
ctx = context.get_admin_context()
ERROR = constants.ERROR
lb_dict = self._create_new_populated_loadbalancer()
lb_id = lb_dict['id']
statuses = self._get_loadbalancer_statuses_api(lb_id)[1]
stat = self._traverse_statuses(statuses, listener="listener_HTTP",
pool="pool_HTTP")
pool_id = stat['id']
self.plugin.db.update_status(ctx, models.PoolV2, pool_id,
provisioning_status=ERROR)
statuses = self._get_loadbalancer_statuses_api(lb_id)[1]
#Assert the parents of the pool are degraded
self._assertDegraded(self._traverse_statuses(statuses,
listener='listener_HTTP'))
self._assertDegraded(self._traverse_statuses(statuses))
#Verify siblings are not degraded
self._assertNotDegraded(self._traverse_statuses(statuses,
listener='listener_HTTPS'))
def _assertOnline(self, obj):
OS = "operating_status"
if OS in obj: