mirror of https://github.com/apache/jclouds.git
I think I got AdvancedNetworkOptionsConverter figured out.
Also made sure not to try to remove FirewallRules unless there's a public IP in the first place.
This commit is contained in:
parent
e6eaa2e192
commit
1261a4c9b0
|
@ -52,7 +52,7 @@ public class AdvancedNetworkOptionsConverter implements OptionsConverter {
|
||||||
checkArgument(!networks.isEmpty(), "please setup a network for zone: " + zoneId);
|
checkArgument(!networks.isEmpty(), "please setup a network for zone: " + zoneId);
|
||||||
Network defaultNetworkInZone = Iterables.getFirst(filter(networks.values(), and(defaultNetworkInZone(zoneId), supportsStaticNAT())), null);
|
Network defaultNetworkInZone = Iterables.getFirst(filter(networks.values(), and(defaultNetworkInZone(zoneId), supportsStaticNAT())), null);
|
||||||
if(defaultNetworkInZone == null) {
|
if(defaultNetworkInZone == null) {
|
||||||
defaultNetworkInZone = Iterables.getFirst(filter(networks.values(), and(isIsolatedNetwork(), not(supportsStaticNAT()))), null);
|
defaultNetworkInZone = Iterables.getFirst(filter(networks.values(), isIsolatedNetwork()), null);
|
||||||
}
|
}
|
||||||
if (defaultNetworkInZone == null) {
|
if (defaultNetworkInZone == null) {
|
||||||
throw new IllegalArgumentException("please choose a specific network in zone " + zoneId + ": " + networks);
|
throw new IllegalArgumentException("please choose a specific network in zone " + zoneId + ": " + networks);
|
||||||
|
|
|
@ -329,6 +329,8 @@ public class CloudStackComputeServiceAdapter implements
|
||||||
// immutable doesn't permit duplicates
|
// immutable doesn't permit duplicates
|
||||||
Set<String> ipAddresses = Sets.newLinkedHashSet();
|
Set<String> ipAddresses = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
String publicIpId = client.getVirtualMachineClient().getVirtualMachine(virtualMachineId).getPublicIPId();
|
||||||
|
if (publicIpId != null) {
|
||||||
Set<FirewallRule> firewallRules = client.getFirewallClient()
|
Set<FirewallRule> firewallRules = client.getFirewallClient()
|
||||||
.listFirewallRules(ListFirewallRulesOptions.Builder.ipAddressId(client.getVirtualMachineClient().getVirtualMachine(virtualMachineId).getPublicIPId()));
|
.listFirewallRules(ListFirewallRulesOptions.Builder.ipAddressId(client.getVirtualMachineClient().getVirtualMachine(virtualMachineId).getPublicIPId()));
|
||||||
|
|
||||||
|
@ -339,6 +341,7 @@ public class CloudStackComputeServiceAdapter implements
|
||||||
logger.debug(">> deleting FirewallRule(%s)", rule.getId());
|
logger.debug(">> deleting FirewallRule(%s)", rule.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ipAddresses;
|
return ipAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue