Network guestNetwork = _networkModel.getNetwork(nic.getNetworkId()); NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, guestNetwork.getNetworkOfferingId()); if (offering.isElasticIp()) { boolean isSystemVM = (vm.getType() == Type.ConsoleProxy || vm.getType() == Type.SecondaryStorageVm);
@Override public IpAddress assignSystemIp(long networkId, Account owner, boolean forElasticLb, boolean forElasticIp) throws InsufficientAddressCapacityException { Network guestNetwork = _networksDao.findById(networkId); NetworkOffering off = _entityMgr.findById(NetworkOffering.class, guestNetwork.getNetworkOfferingId()); IpAddress ip = null; if ((off.isElasticLb() && forElasticLb) || (off.isElasticIp() && forElasticIp)) { try { s_logger.debug("Allocating system IP address for load balancer rule..."); // allocate ip ip = allocateIP(owner, true, guestNetwork.getDataCenterId()); // apply ip associations ip = associateIPToGuestNetwork(ip.getId(), networkId, true); ; } catch (ResourceAllocationException ex) { throw new CloudRuntimeException("Failed to allocate system ip due to ", ex); } catch (ConcurrentOperationException ex) { throw new CloudRuntimeException("Failed to allocate system lb ip due to ", ex); } catch (ResourceUnavailableException ex) { throw new CloudRuntimeException("Failed to allocate system lb ip due to ", ex); } if (ip == null) { throw new CloudRuntimeException("Failed to allocate system ip"); } } return ip; }
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, guestNetwork.getNetworkOfferingId()); Long vmId = ipVO.getAssociatedWithVmId(); if (offering.isElasticIp() && vmId != null) { _rulesMgr.getSystemIpAndEnableStaticNatForVm(_userVmDao.findById(vmId), true); return true;
Network guestNetwork = _networkModel.getNetwork(networkId); NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, guestNetwork.getNetworkOfferingId()); if (offering.isElasticIp()) { reassignStaticNat = true;
eIp.setValue(offering.isElasticIp() ? "true" : "false"); staticNatCapResponse.add(eIp);
@Override @ActionEvent(eventType = EventTypes.EVENT_DISABLE_STATIC_NAT, eventDescription = "disabling static nat", async = true) public boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException { CallContext ctx = CallContext.current(); Account caller = ctx.getCallingAccount(); IPAddressVO ipAddress = _ipAddressDao.findById(ipId); checkIpAndUserVm(ipAddress, null, caller, false); if (ipAddress.getSystem()) { InvalidParameterValueException ex = new InvalidParameterValueException("Can't disable static nat for system IP address with specified id"); ex.addProxyObject(ipAddress.getUuid(), "ipId"); throw ex; } Long vmId = ipAddress.getAssociatedWithVmId(); if (vmId == null) { InvalidParameterValueException ex = new InvalidParameterValueException("Specified IP address id is not associated with any vm Id"); ex.addProxyObject(ipAddress.getUuid(), "ipId"); throw ex; } // if network has elastic IP functionality supported, we first have to disable static nat on old ip in order to // re-enable it on the new one enable static nat takes care of that Network guestNetwork = _networkModel.getNetwork(ipAddress.getAssociatedWithNetworkId()); NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, guestNetwork.getNetworkOfferingId()); if (offering.isElasticIp()) { if (offering.isAssociatePublicIP()) { getSystemIpAndEnableStaticNatForVm(_vmDao.findById(vmId), true); return true; } } return disableStaticNat(ipId, caller, ctx.getCallingUserId(), false); }
if (zone.getNetworkType() == NetworkType.Basic && offering.isElasticIp() && offering.isElasticLb()) {
if (off.isElasticIp()) { throw new InvalidParameterValueException("Can't create ip forwarding rules for the network where elasticIP service is enabled");
if (networkOffering.isElasticIp()) { IpAddress ip = ApiDBUtils.findIpByAssociatedVmId(vm.getId()); if (ip != null) {