Esempio n. 1
0
    def _assure_loadbalancer_created(self, service, all_subnet_hints):
        if 'loadbalancer' not in service:
            return
        bigips = self.driver.get_config_bigips()
        loadbalancer = service["loadbalancer"]
        set_active = True

        if self._is_not_pending_delete(loadbalancer):

            vip_address = virtual_address.VirtualAddress(
                self.service_adapter,
                loadbalancer)
            for bigip in bigips:
                try:
                    vip_address.assure(bigip)
                except Exception as error:
                    LOG.error(str(error))
                    self._set_status_as_error(loadbalancer)
                    set_active = False

            self._set_status_as_active(loadbalancer, force=set_active)

        if self.driver.l3_binding:
            loadbalancer = service["loadbalancer"]
            self.driver.l3_binding.bind_address(
                subnet_id=loadbalancer["vip_subnet_id"],
                ip_address=loadbalancer["vip_address"])

        self._update_subnet_hints(loadbalancer["provisioning_status"],
                                  loadbalancer["vip_subnet_id"],
                                  loadbalancer["network_id"],
                                  all_subnet_hints,
                                  False)
Esempio n. 2
0
    def _assure_loadbalancer_created(self, service, all_subnet_hints):
        if 'loadbalancer' not in service:
            return
        bigips = self.driver.get_config_bigips()
        loadbalancer = service["loadbalancer"]

        # if self._is_not_pending_delete(loadbalancer):
        if loadbalancer["provisioning_status"] in self.const_status:

            vip_address = virtual_address.VirtualAddress(
                self.service_adapter, loadbalancer)
            for bigip in bigips:
                try:
                    vip_address.assure(bigip)
                except Exception as error:
                    LOG.error(str(error))
                    self._set_status_as_error(loadbalancer)

            # pzhang (NOTE): do not set this balancer ACTIVE,
            #                before we really update loadbalancer
            #                since we only update neutron db
            #                (loadbalancer ACTIVE)
            #                which loadbalancer is in PENDING_STATUES
            # self._set_status_as_active(loadbalancer, force=set_active)

        if self.driver.l3_binding:
            loadbalancer = service["loadbalancer"]
            self.driver.l3_binding.bind_address(
                subnet_id=loadbalancer["vip_subnet_id"],
                ip_address=loadbalancer["vip_address"])

        self._update_subnet_hints(loadbalancer["provisioning_status"],
                                  loadbalancer["vip_subnet_id"],
                                  loadbalancer["network_id"], all_subnet_hints,
                                  False)
Esempio n. 3
0
    def _assure_loadbalancer_deleted(self, service):
        if (service['loadbalancer']['provisioning_status'] !=
                plugin_const.PENDING_DELETE):
            return

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

        if self.driver.l3_binding:
            self.driver.l3_binding.unbind_address(
                subnet_id=loadbalancer["vip_subnet_id"],
                ip_address=loadbalancer["vip_address"])

        vip_address = virtual_address.VirtualAddress(self.service_adapter,
                                                     loadbalancer)

        for bigip in bigips:
            vip_address.assure(bigip, delete=True)
Esempio n. 4
0
    def _assure_loadbalancer_created(self, service, all_subnet_hints):
        if 'loadbalancer' not in service:
            return
        bigips = self.driver.get_config_bigips()
        loadbalancer = service["loadbalancer"]

        vip_address = virtual_address.VirtualAddress(self.service_adapter,
                                                     loadbalancer)
        for bigip in bigips:
            vip_address.assure(bigip)

        if self.driver.l3_binding:
            loadbalancer = service["loadbalancer"]
            self.driver.l3_binding.bind_address(
                subnet_id=loadbalancer["vip_subnet_id"],
                ip_address=loadbalancer["vip_address"])

        self._update_subnet_hints(loadbalancer["provisioning_status"],
                                  loadbalancer["vip_subnet_id"],
                                  loadbalancer["network_id"], all_subnet_hints,
                                  False)