@Override public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { if (vm.getType() != VirtualMachine.Type.DomainRouter && _nuageVspEntityBuilder.usesVirtualRouter(network.getNetworkOfferingId())) { VspNetwork vspNetwork = _nuageVspEntityBuilder.buildVspNetwork(network); if (nic != null && nic.getRequestedIPv4() != null && nic.getRequestedIPv4().equals(vspNetwork.getVirtualRouterIp())) { DataCenter dc = _dcDao.findById(network.getDataCenterId()); s_logger.error("Unable to acquire requested Guest IP address " + nic.getRequestedIPv4() + " because it is reserved for the VR in network " + network); throw new InsufficientVirtualNetworkCapacityException("Unable to acquire requested Guest IP address " + nic.getRequestedIPv4() + " because it is reserved " + "for the VR in network " + network, DataCenter.class,dc.getId()); } } return super.allocate(network, nic, vm); }
/** * Allocate the NicProfile object. * At this point the UUID of the nic is not yet known. We defer allocating the VMI and instance-ip objects * until the reserve API is called because of this reason. */ @Override public NicProfile allocate(Network network, NicProfile profile, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException { s_logger.debug("allocate NicProfile on " + network.getName()); if (profile != null && profile.getRequestedIPv4() != null) { throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + profile); } if (profile == null) { profile = new NicProfile(ReservationStrategy.Create, null, null, null, null); } profile.setReservationStrategy(ReservationStrategy.Start); URI broadcastUri = null; try { broadcastUri = new URI("vlan://untagged"); } catch (Exception e) { s_logger.warn("unable to instantiate broadcast URI: " + e); } profile.setBroadcastUri(broadcastUri); return profile; }
@Override public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException { TrafficType trafficType = config.getTrafficType(); assert trafficType == TrafficType.Management || trafficType == TrafficType.Storage : "Well, I can't take care of this config now can I? " + config; if (nic != null) { if (nic.getRequestedIPv4() != null) { throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic); } nic.setReservationStrategy(nic.getIPv4Address() != null ? ReservationStrategy.Create : ReservationStrategy.Start); } else { nic = new NicProfile(ReservationStrategy.Start, null, null, null, null); } return nic; }
@Override public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, 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); if (_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) { profile.setReservationStrategy(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.setIPv4Gateway(null); profile.setIPv4Netmask(null); } return profile; }
return; String requestedIpv4Address = requestedNicProfile.getRequestedIPv4(); if (requestedIpv4Address == null) { return;
@Override public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException { DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (nic != null && nic.getRequestedIPv4() != null) { throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic); } if (nic == null) { nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); } getIp(nic, dc, vm, network); if (nic.getIPv4Address() == null) { nic.setReservationStrategy(ReservationStrategy.Start); } else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) { nic.setReservationStrategy(ReservationStrategy.Managed); } else { nic.setReservationStrategy(ReservationStrategy.Create); } return nic; }
@Override public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapacityException, InsufficientAddressCapacityException, ConcurrentOperationException { DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (nic == null) { nic = new NicProfile(ReservationStrategy.Create, null, null, null, null); } else if (nic.getIPv4Address() == null && nic.getIPv6Address() == null) { nic.setReservationStrategy(ReservationStrategy.Start); } else { nic.setReservationStrategy(ReservationStrategy.Create); } allocateDirectIp(nic, network, vm, dc, nic.getRequestedIPv4(), nic.getRequestedIPv6()); nic.setReservationStrategy(ReservationStrategy.Create); if (nic.getMacAddress() == null) { nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId())); if (nic.getMacAddress() == null) { throw new InsufficientAddressCapacityException("Unable to allocate more mac addresses", Network.class, network.getId()); } } return nic; }
_ipAddrMgr.allocateDirectIp(nic, dc, vm, network, nic.getRequestedIPv4(), null); } else { guestIp = network.getGateway(); } else { guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4()); if (guestIp == null && network.getGuestType() != GuestType.L2 && !_networkModel.listNetworkOfferingServices(network.getNetworkOfferingId()).isEmpty()) { throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,