/** * @see RouterDeploymentDefinition#prepareDeployment() * * @return if the deployment can proceed */ @Override protected boolean prepareDeployment() { //Check if the VR is the src NAT provider... isPublicNetwork = vpcMgr.isSrcNatIpRequired(vpc.getVpcOfferingId()); // Check if public network has to be set on VR return true; }
@Override protected void findServiceOfferingId() { serviceOfferingId = vpcOffDao.findById(vpc.getVpcOfferingId()).getServiceOfferingId(); if (serviceOfferingId == null) { findDefaultServiceOfferingId(); } }
private void reassignPublicIpsToNewVpc(long srcVpcId, Vpc dstVpc) { List<? extends IPAddressVO> publicIps = _ipAddressDao.listByAssociatedVpc(srcVpcId, _vpcManager.isSrcNatIpRequired(dstVpc.getVpcOfferingId()) ? null : false); for(IPAddressVO publicIp : publicIps) { publicIp.setVpcId(dstVpc.getId()); _ipAddressDao.persist(publicIp); } }
@Override public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { List<VpcOfferingServiceMapVO> vpcOfferingServices = _vpcOfferingSrvcDao.listByVpcOffId(vpc.getVpcOfferingId()); Multimap<Service, Provider> supportedVpcServices = NuageVspManagerImpl.SUPPORTED_NUAGE_VSP_VPC_SERVICE_MAP; for (VpcOfferingServiceMapVO vpcOfferingService : vpcOfferingServices) { Network.Service service = Network.Service.getService(vpcOfferingService.getService()); if (!supportedVpcServices.containsKey(service)) { s_logger.warn(String.format("NuageVsp doesn't support service %s for VPCs", service.getName())); return false; } Network.Provider provider = Network.Provider.getProvider(vpcOfferingService.getProvider()); if (!supportedVpcServices.containsEntry(service, provider)) { s_logger.warn(String.format("NuageVsp doesn't support provider %s for service %s for VPCs", provider.getName(), service.getName())); return false; } } String globalDomainTemplate = _nuageVspManager.NuageVspVpcDomainTemplateName.value(); if (StringUtils.isNotBlank(globalDomainTemplate) && !_nuageVspManager.checkIfDomainTemplateExist(vpc.getDomainId(),globalDomainTemplate,vpc.getZoneId(),null)) { s_logger.warn("The global pre configured domain template does not exist on the VSD."); throw new CloudRuntimeException("The global pre configured domain template does not exist on the VSD."); } return true; }
private void verifyAlreadyMigratedTiers(long migratedVpcId, long vpcOfferingId, Map<String, String> networkToOffering) { Vpc migratedVpc = _vpcDao.findById(migratedVpcId); if (migratedVpc.getVpcOfferingId() != vpcOfferingId) { s_logger.error("The vpc is already partially migrated in a previous run. The provided vpc offering is not the same as the one used during the first migration process."); throw new InvalidParameterValueException("Failed to resume migrating VPC as VPC offering does not match previously specified VPC offering (" + migratedVpc.getVpcOfferingId() + ")"); } List<NetworkVO> migratedTiers = _networksDao.listByVpc(migratedVpcId); for (Network tier : migratedTiers) { String tierNetworkOfferingUuid = networkToOffering.get(tier.getUuid()); if (!StringUtils.isNotBlank(tierNetworkOfferingUuid)) { throwInvalidIdException("Failed to resume migrating VPC as the specified tierNetworkOfferings is not complete", String.valueOf(tier.getUuid()), "networkUuid"); } NetworkOfferingVO newNetworkOffering = _networkOfferingDao.findByUuid(tierNetworkOfferingUuid); if (newNetworkOffering == null) { throw new InvalidParameterValueException("Failed to migrate VPC as at least one tier offering in tierNetworkOfferings does not exist."); } if (newNetworkOffering.getId() != tier.getNetworkOfferingId()) { NetworkOfferingVO tierNetworkOffering = _networkOfferingDao.findById(tier.getNetworkOfferingId()); throw new InvalidParameterValueException( "Failed to resume migrating VPC as at least one network offering in tierNetworkOfferings does not match previously specified network offering (network uuid=" + tier.getUuid() + " was previously specified with offering uuid=" + tierNetworkOffering.getUuid() + ")"); } } }
final List<NicProfile> publicNics = new ArrayList<NicProfile>(); Network publicNetwork = null; final Map<Network.Service, Set<Network.Provider>> vpcOffSvcProvidersMap = vpcMgr.getVpcOffSvcProvidersMap(vpcRouterDeploymentDefinition.getVpc().getVpcOfferingId());
final boolean isSourceNatFinal = isSrcNatIpRequired(vpc.getVpcOfferingId()) && getExistingSourceNatInVpc(owner.getId(), vpcId) == null; Transaction.execute(new TransactionCallbackNoReturn() { @Override
response.setDisplayText(vpc.getDisplayText()); response.setState(vpc.getState().name()); VpcOffering voff = ApiDBUtils.findVpcOfferingById(vpc.getVpcOfferingId()); if (voff != null) { response.setVpcOfferingId(voff.getUuid()); response.setRegionLevelVpc(vpc.isRegionLevelVpc()); Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(vpc.getVpcOfferingId()); List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>(); for (Map.Entry<Service,Set<Provider>>entry : serviceProviderMap.entrySet()) {
_accountMgr.checkAccess(account, null, true, vpc); if (vpc.getVpcOfferingId() == vpcOfferingId) { return vpc;
final String pr = nSvcVO.getProvider(); final String service = nSvcVO.getService(); if (_vpcOffServiceDao.findByServiceProviderAndOfferingId(service, pr, vpc.getVpcOfferingId()) == null) { throw new InvalidParameterValueException("Service/provider combination " + service + "/" + pr + " is not supported by VPC " + vpc);