@Override public NicProfile allocate( Network config, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException { if (_networkModel.networkIsConfiguredForExternalNetworking( config.getDataCenterId(), config.getId()) && nic != null && nic.getRequestedIpv4() != null) { throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic); } NicProfile profile = super.allocate(config, nic, vm); boolean _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())); if (_isEnabled) { return null; } if (_networkModel.networkIsConfiguredForExternalNetworking( config.getDataCenterId(), config.getId())) { profile.setStrategy(ReservationStrategy.Start); /* We won't clear IP address, because router may set gateway as it IP, and it would be updated properly later */ // profile.setIp4Address(null); profile.setGateway(null); profile.setNetmask(null); } return profile; }
@Override public NicProfile allocate( Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (nic == null) { nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); } else if (nic.getIp4Address() == null) { nic.setStrategy(ReservationStrategy.Start); } else { nic.setStrategy(ReservationStrategy.Create); } _networkMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIp()); nic.setStrategy(ReservationStrategy.Create); return nic; }
@Override public void reserve( NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { if (nic.getIp4Address() == null) { _networkMgr.allocateDirectIp(nic, dest.getDataCenter(), vm, network, null); nic.setStrategy(ReservationStrategy.Create); } }
@Override public NicProfile allocate( Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { if (network.getTrafficType() != TrafficType.Public) { return null; } if (nic == null) { nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); } DataCenter dc = _dcDao.findById(network.getDataCenterId()); getIp(nic, dc, vm, network); if (nic.getIp4Address() == null) { nic.setStrategy(ReservationStrategy.Start); } else { nic.setStrategy(ReservationStrategy.Create); } return nic; }