Exemplo n.º 1
0
    def delete_pool(self, service, bigips):
        """Delete a pool on set of BIG-IPs.

        Deletes a BIG-IP pool defined by LBaaS pool object.

        :param service: Dictionary which contains a both a pool
        and load balancer definition.
        :param bigips: Array of BigIP class instances to delete pool.
        """
        loadbalancer = service.get('loadbalancer')
        pool = self.service_adapter.get_pool(service)
        members = service.get('members', list())

        error = None
        for bigip in bigips:
            try:
                self.pool_helper.delete(bigip,
                                        name=pool["name"],
                                        partition=pool["partition"])
            except HTTPError as err:
                if err.response.status_code != 404:
                    error = f5_ex.PoolDeleteException(err.message)
                    LOG.error("Failed to remove pool %s from %s: %s",
                              pool['name'], bigip, error.message)
            except Exception as err:
                error = f5_ex.PoolDeleteException(err.message)
                LOG.error("Failed to remove pool %s from %s: %s", pool['name'],
                          bigip, error.message)

            for member in members:
                self._delete_member_node(loadbalancer, member, bigip)

        return error
Exemplo n.º 2
0
    def _assure_pools_deleted(self, service):
        if 'pools' not in service:
            return

        pools = service["pools"]
        loadbalancer = service["loadbalancer"]
        bigips = self.driver.get_config_bigips()

        for pool in pools:
            # Is the pool being deleted?
            if pool['provisioning_status'] == plugin_const.PENDING_DELETE:
                svc = {"loadbalancer": loadbalancer, "pool": pool}

                try:

                    # update listeners for pool
                    for listener in pool['listeners']:
                        svc['listener'] = \
                            self.get_listener_by_id(service, listener['id'])

                        # remove pool name from virtual before deleting pool
                        self.listener_builder.update_listener_pool(
                            svc, "", bigips)

                        self.listener_builder.remove_session_persistence(
                            svc, bigips)

                    # delete pool
                    self.pool_builder.delete_pool(svc, bigips)

                except Exception as err:
                    pool['provisioning_status'] = plugin_const.ERROR
                    raise f5_ex.PoolDeleteException(err.message)