def _provision_tenant_private_network(self, context, tenant_id): """Create a tenant private network/subnets.""" network = None try: network_args = { 'name': 'auto_allocated_network', 'admin_state_up': True, 'tenant_id': tenant_id, 'shared': False } network = p_utils.create_network( self.core_plugin, context, {'network': network_args}) subnets = [] for pool in self._get_supported_subnetpools(context): subnet_args = { 'name': 'auto_allocated_subnet_v%s' % pool['ip_version'], 'network_id': network['id'], 'tenant_id': tenant_id, 'ip_version': pool['ip_version'], 'subnetpool_id': pool['id'], } subnets.append(p_utils.create_subnet( self.core_plugin, context, {'subnet': subnet_args})) return subnets except (ValueError, n_exc.BadRequest, n_exc.NotFound): LOG.error(_LE("Unable to auto allocate topology for tenant " "%s due to missing requirements, e.g. default " "or shared subnetpools"), tenant_id) if network: self._cleanup(context, network['id']) raise exceptions.AutoAllocationFailure( reason=_("Unable to provide tenant private network"))
def _provision_tenant_private_network(self, context, tenant_id): """Create a tenant private network/subnets.""" network = None try: network_args = { 'name': 'auto_allocated_network', 'admin_state_up': True, 'tenant_id': tenant_id, 'shared': False } network = p_utils.create_network( self.core_plugin, context, {'network': network_args}) subnets = [] for pool in self._get_supported_subnetpools(context): subnet_args = { 'name': 'auto_allocated_subnet_v%s' % pool['ip_version'], 'network_id': network['id'], 'tenant_id': tenant_id, 'ip_version': pool['ip_version'], 'subnetpool_id': pool['id'], } subnets.append(p_utils.create_subnet( self.core_plugin, context, {'subnet': subnet_args})) return subnets except (ValueError, n_exc.BadRequest, n_exc.NotFound): LOG.error(_LE("Unable to auto allocate topology for tenant " "%s due to missing requirements, e.g. default " "or shared subnetpools"), tenant_id) if network: self._cleanup(context, network['id']) raise exceptions.AutoAllocationFailure( reason=_("Unable to provide tenant private network"))
def _create_ha_subnet(self, context, network_id, tenant_id): args = {'network_id': network_id, 'tenant_id': '', 'name': n_const.HA_SUBNET_NAME % tenant_id, 'ip_version': 4, 'cidr': cfg.CONF.l3_ha_net_cidr, 'enable_dhcp': False, 'gateway_ip': None} return p_utils.create_subnet(self._core_plugin, context, {'subnet': args})
def _create_ha_subnet(self, context, network_id, tenant_id): args = {'network_id': network_id, 'tenant_id': '', 'name': n_const.HA_SUBNET_NAME % tenant_id, 'ip_version': 4, 'cidr': cfg.CONF.l3_ha_net_cidr, 'enable_dhcp': False, 'gateway_ip': None} return p_utils.create_subnet(self._core_plugin, context, {'subnet': args})
def _create_ha_subnet(self, context, network_id, tenant_id): args = { "network_id": network_id, "tenant_id": "", "name": constants.HA_SUBNET_NAME % tenant_id, "ip_version": 4, "cidr": cfg.CONF.l3_ha_net_cidr, "enable_dhcp": False, "gateway_ip": None, } return p_utils.create_subnet(self._core_plugin, context, {"subnet": args})
def _provision_tenant_private_network(self, context, tenant_id): """Create a tenant private network/subnets. CCloud specific: use specific cidr range instead of default subnetpool """ network = None try: network_args = { 'name': 'auto_allocated_network', 'admin_state_up': False, 'tenant_id': tenant_id, 'shared': False } network = p_utils.create_network(self.core_plugin, context, {'network': network_args}) subnets = [] subnet_args = { 'name': 'auto_allocated_subnet_v4', 'network_id': network['id'], 'tenant_id': tenant_id, 'ip_version': 4, 'cidr': '10.180.0.0/24', } subnets.append( p_utils.create_subnet(self.core_plugin, context, {'subnet': subnet_args})) return subnets except (c_exc.SubnetAllocationError, ValueError, n_exc.BadRequest, n_exc.NotFound) as e: LOG.error( "Unable to auto allocate topology for tenant " "%(tenant_id)s due to missing or unmet " "requirements. Reason: %(reason)s", { 'tenant_id': tenant_id, 'reason': e }) if network: self._cleanup(context, network['id']) raise exceptions.AutoAllocationFailure( reason=_("Unable to provide tenant private network")) except Exception as e: network_id = network['id'] if network else None raise exceptions.UnknownProvisioningError(e, network_id=network_id)
def _provision_tenant_private_network(self, context, tenant_id): """Create a tenant private network/subnets.""" network = None try: network_args = { 'name': 'auto_allocated_network', 'admin_state_up': False, 'tenant_id': tenant_id, 'shared': False } network = p_utils.create_network( self.core_plugin, context, {'network': network_args}) subnets = [] for pool in self._get_supported_subnetpools(context): subnet_args = { 'name': 'auto_allocated_subnet_v%s' % pool['ip_version'], 'network_id': network['id'], 'tenant_id': tenant_id, 'ip_version': pool['ip_version'], 'subnetpool_id': pool['id'], } subnets.append(p_utils.create_subnet( self.core_plugin, context, {'subnet': subnet_args})) return subnets except (c_exc.SubnetAllocationError, ValueError, n_exc.BadRequest, n_exc.NotFound) as e: LOG.error(_LE("Unable to auto allocate topology for tenant " "%(tenant_id)s due to missing or unmet " "requirements. Reason: %(reason)s"), {'tenant_id': tenant_id, 'reason': e}) if network: self._cleanup(context, network['id']) raise exceptions.AutoAllocationFailure( reason=_("Unable to provide tenant private network")) except Exception as e: network_id = network['id'] if network else None raise exceptions.UnknownProvisioningError(e, network_id=network_id)
def _provision_tenant_private_network(self, context, tenant_id): """Create a tenant private network/subnets.""" network = None try: network_args = { "name": "auto_allocated_network", "admin_state_up": False, "tenant_id": tenant_id, "shared": False, } network = p_utils.create_network(self.core_plugin, context, {"network": network_args}) subnets = [] for pool in self._get_supported_subnetpools(context): subnet_args = { "name": "auto_allocated_subnet_v%s" % pool["ip_version"], "network_id": network["id"], "tenant_id": tenant_id, "ip_version": pool["ip_version"], "subnetpool_id": pool["id"], } subnets.append(p_utils.create_subnet(self.core_plugin, context, {"subnet": subnet_args})) return subnets except (c_exc.SubnetAllocationError, ValueError, n_exc.BadRequest, n_exc.NotFound) as e: LOG.error( _LE( "Unable to auto allocate topology for tenant " "%(tenant_id)s due to missing or unmet " "requirements. Reason: %(reason)s" ), {"tenant_id": tenant_id, "reason": e}, ) if network: self._cleanup(context, network["id"]) raise exceptions.AutoAllocationFailure(reason=_("Unable to provide tenant private network")) except Exception as e: network_id = network["id"] if network else None raise exceptions.UnknownProvisioningError(e, network_id=network_id)