def delete(self, context, id, pool_id): try: member = self._api.loadbalancer_member_read(id=id) except NoIdError: raise loadbalancerv2.EntityNotFound(name=self.neutron_name, id=id) try: pool = self._api.loadbalancer_pool_read(id=pool_id) except NoIdError: raise loadbalancerv2.EntityNotFound(name='Pool', id=pool_id) if id not in [member['uuid'] for member in pool.get_loadbalancer_members() or []]: raise loadbalancerv2.MemberNotFoundForPool(member_id=id, pool_id=pool_id) super(LoadbalancerMemberManager, self).delete(context, id)
def get_resource(self, context, id, pool_id, fields=None): res = super(LoadbalancerMemberManager, self).get_resource(context, id) if res and res['pool_id'] != pool_id: raise loadbalancerv2.MemberNotFoundForPool(member_id=res['id'], pool_id=res['pool_id']) return self._fields(res, fields)