public static List<Address> tryAssignSystemAddresses(ResourceToken token) throws Exception { if (!EucalyptusProperties.disableNetworking) { try { List<Address> newAddresses = AddressUtil.allocateAddresses(token.getCluster(), token.getAmount()); return newAddresses; } catch (Exception e) { throw e; } } else { throw new NotEnoughResourcesAvailable( "Not enough resources available: addresses (not supported by cluster)."); } }
public static void tryAssignSystemAddress(final VmInstance vm) { if (!EucalyptusProperties.disableNetworking) { try { Address newAddress = AddressUtil.allocateAddresses(vm.getPlacement(), 1).get(0); newAddress.setInstanceId(vm.getInstanceId()); newAddress.setInstanceAddress(vm.getNetworkConfig().getIpAddress()); AddressUtil.dispatchAssignAddress(newAddress, vm); } catch (NotEnoughResourcesAvailable notEnoughResourcesAvailable) { LOG.error( "Attempt to assign a system address for " + vm.getInstanceId() + " failed due to lack of addresses."); } catch (Exception e) { LOG.error( "Attempt to assign a system address for " + vm.getInstanceId() + " failed due to lack of addresses."); } } }