@Override public boolean apply(Network input) { return "none".equals(input.getName()); }
@Override public boolean apply(Network input) { return "none".equals(input.getName()); }
@Override public boolean apply(Network input) { return "none".equals(input.getName()); }
@Override public String apply(VAppTemplate vAppTemplate) { checkArgument(vAppTemplate != null, "vAppTemplate was null!"); Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks(); checkArgument(networks.size() > 0, "no networks found in vAppTemplate %s", vAppTemplate); if (networks.size() > 1) logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks); return get(networks, 0).getName(); } }
@Override public String apply(VAppTemplate vAppTemplate) { checkArgument(vAppTemplate != null, "vAppTemplate was null!"); Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks(); checkArgument(networks.size() > 0, "no networks found in vAppTemplate %s", vAppTemplate); if (networks.size() > 1) logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks); return get(networks, 0).getName(); } }
@Override public String apply(VAppTemplate vAppTemplate) { checkArgument(vAppTemplate != null, "vAppTemplate was null!"); Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks(); checkArgument(networks.size() > 0, "no networks found in vAppTemplate %s", vAppTemplate); if (networks.size() > 1) logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks); return get(networks, 0).getName(); } }
public Builder fromNetwork(Network in) { return name(in.getName()).description(in.getDescription()); } }
public Builder fromNetwork(Network in) { return name(in.getName()).description(in.getDescription()); } }
public Builder fromNetwork(Network in) { return name(in.getName()).description(in.getDescription()); } }
public Builder fromNetwork(Network in) { return name(in.getName()).description(in.getDescription()); } }
public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) { Network networkToConnect = find(vApp.getNetworkSection().getNetworks(), not(networkWithNoIpAllocation)); Vm vm = get(vApp.getChildren(), 0); NetworkConnectionSection net = vm.getNetworkConnectionSection(); checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm); NetworkConnection toConnect = findWithPoolAllocationOrFirst(net); if (ipAllocationMode == null) ipAllocationMode = toConnect.getIpAddressAllocationMode(); // make sure that we are in fact allocating ips if (ipAllocationMode == IpAddressAllocationMode.NONE) ipAllocationMode = IpAddressAllocationMode.POOL; if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode && toConnect.getNetwork().equals(networkToConnect.getName())) { // then we don't need to change the network settings, and can save a call } else { Builder builder = net.toBuilder(); builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true) .ipAddressAllocationMode(ipAllocationMode).build())); logger.trace(">> updating networkConnection vm(%s)", vm.getName()); waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref())); logger.trace("<< updated networkConnection vm(%s)", vm.getName()); } }
public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) { Network networkToConnect = find(vApp.getNetworkSection().getNetworks(), not(networkWithNoIpAllocation)); Vm vm = get(vApp.getChildren(), 0); NetworkConnectionSection net = vm.getNetworkConnectionSection(); checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm); NetworkConnection toConnect = findWithPoolAllocationOrFirst(net); if (ipAllocationMode == null) ipAllocationMode = toConnect.getIpAddressAllocationMode(); // make sure that we are in fact allocating ips if (ipAllocationMode == IpAddressAllocationMode.NONE) ipAllocationMode = IpAddressAllocationMode.POOL; if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode && toConnect.getNetwork().equals(networkToConnect.getName())) { // then we don't need to change the network settings, and can save a call } else { Builder builder = net.toBuilder(); builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true) .ipAddressAllocationMode(ipAllocationMode).build())); logger.trace(">> updating networkConnection vm(%s)", vm.getName()); waitForTask(client.getVmClient().updateNetworkConnectionOfVm(builder.build(), vm.getHref())); logger.trace("<< updated networkConnection vm(%s)", vm.getName()); } }
public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) { Network networkToConnect = find(vApp.getNetworkSection().getNetworks(), not(networkWithNoIpAllocation)); Vm vm = get(vApp.getChildren(), 0); NetworkConnectionSection net = vm.getNetworkConnectionSection(); checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm); NetworkConnection toConnect = findWithPoolAllocationOrFirst(net); if (ipAllocationMode == null) ipAllocationMode = toConnect.getIpAddressAllocationMode(); // make sure that we are in fact allocating ips if (ipAllocationMode == IpAddressAllocationMode.NONE) ipAllocationMode = IpAddressAllocationMode.POOL; if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode && toConnect.getNetwork().equals(networkToConnect.getName())) { // then we don't need to change the network settings, and can save a call } else { Builder builder = net.toBuilder(); builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true) .ipAddressAllocationMode(ipAllocationMode).build())); logger.trace(">> updating networkConnection vm(%s)", vm.getName()); waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref())); logger.trace("<< updated networkConnection vm(%s)", vm.getName()); } }
config = config.toBuilder().networkName(networkToConnect.getName()).build();
config = config.toBuilder().networkName(networkToConnect.getName()).build();
config = config.toBuilder().networkName(networkToConnect.getName()).build();