def update_backend_pool(self, nsx_pool_id, subnet_request): update_args = { 'cidr': self._get_cidr_from_request(subnet_request), 'allocation_ranges': self._get_ranges_from_request(subnet_request), 'gateway_ip': subnet_request.gateway_ip } try: self.nsxlib_ipam.update(nsx_pool_id, **update_args) except nsx_lib_exc.ManagerError as e: LOG.error( "NSX IPAM failed to update pool %(id)s: " " %(e)s; code %(code)s", { 'e': e, 'id': nsx_pool_id, 'code': e.error_code }) if (e.error_code == error.ERR_CODE_IPAM_RANGE_MODIFY or e.error_code == error.ERR_CODE_IPAM_RANGE_DELETE or e.error_code == error.ERR_CODE_IPAM_RANGE_SHRUNK): # The change is not allowed: already allocated IPs out of # the new range raise ipam_exc.InvalidSubnetRequest( reason=_("Already allocated IPs outside of the updated " "pools")) except Exception as e: # unexpected error msg = _('Failed to update subnet IPAM: %s') % e raise ipam_exc.IpamValueInvalid(message=msg)
def update_subnet(self, subnet_request): """Update subnet info the in the IPAM driver. The only update subnet information the driver needs to be aware of are allocation pools. """ if not subnet_request.subnet_id: raise ipam_exc.InvalidSubnetRequest( reason=("An identifier must be specified when updating " "a subnet")) if not subnet_request.allocation_pools: LOG.debug("Update subnet request for subnet %s did not specify " "new allocation pools, there is nothing to do", subnet_request.subnet_id) return subnet = NeutronDbSubnet.load(subnet_request.subnet_id, self._context) subnet.update_allocation_pools(subnet_request.allocation_pools) return subnet
def update_subnet(self, subnet_request): """Update subnet info the in the IPAM driver. The only update subnet information the driver needs to be aware of are allocation pools. """ if not subnet_request.subnet_id: raise ipam_exc.InvalidSubnetRequest( reason=_("An identifier must be specified when updating " "a subnet")) if subnet_request.allocation_pools is None: LOG.debug( "Update subnet request for subnet %s did not specify " "new allocation pools, there is nothing to do", subnet_request.subnet_id) return subnet = NeutronDbSubnet.load(subnet_request.subnet_id, self._context) cidr = netaddr.IPNetwork(subnet._cidr) subnet.update_allocation_pools(subnet_request.allocation_pools, cidr) # BlueCat additions paramsBAM = getBCNConfig(BC_configFileName) if (paramsBAM['bam_updatemodify_networks'] == "True"): soap_client = _bam_login(paramsBAM) configID = _get_bam_configid(paramsBAM, soap_client) LOG.info("BCN: Got configID %s" % (configID)) cidr = str(subnet_request._subnet_cidr.ip) + "/" + str( subnet_request._subnet_cidr.prefixlen) LOG.info("BCN: Updating Network %s %s in BAM ...\n" % (cidr, subnet_request.name)) updateBCNetwork(soap_client, configID, cidr, subnet_request.name, subnet_request.subnet_id) _bam_logout(paramsBAM, soap_client) return subnet
def update_subnet(self, subnet_request): """Update subnet info the in the IPAM driver. The only update subnet information the driver needs to be aware of are allocation pools. """ if not subnet_request.subnet_id: raise ipam_exc.InvalidSubnetRequest( reason=_("An identifier must be specified when updating " "a subnet")) if subnet_request.allocation_pools is None: LOG.debug("Update subnet request for subnet %s did not specify " "new allocation pools, there is nothing to do", subnet_request.subnet_id) return subnet = NeutronDbSubnet.load(subnet_request.subnet_id, self._context) cidr = netaddr.IPNetwork(subnet._cidr) subnet.update_allocation_pools(subnet_request.allocation_pools, cidr) # BlueCat additions paramsBAM = getBCNConfig(BC_configFileName, "BAM")