Merge pull request #679 from aplowe/cloudstackfix

Fix for cloudstack ip to network mapping call
This commit is contained in:
Adrian Cole 2012-06-20 15:28:30 -07:00
commit a12e10d7f3
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public class AdvancedNetworkOptionsConverter implements OptionsConverter {
checkArgument(templateOptions.getSecurityGroupIds().isEmpty(), "security groups cannot be specified for locations (zones) that use advanced networking");
if (templateOptions.getNetworkIds().size() > 0) {
options.networkIds(templateOptions.getNetworkIds());
} else {
} else if (templateOptions.getIpsToNetworks().isEmpty()) {
checkArgument(!networks.isEmpty(), "please setup a network for zone: " + zoneId);
Network defaultNetworkInZone = Iterables.getFirst(filter(networks.values(), and(defaultNetworkInZone(zoneId), supportsStaticNAT())), null);
if(defaultNetworkInZone == null) {

View File

@ -129,8 +129,8 @@ public class DeployVirtualMachineOptions extends AccountInDomainOptions {
public DeployVirtualMachineOptions ipsToNetworks(Map<String, String> ipsToNetworks) {
int count = 0;
for (String ip : ipsToNetworks.keySet()) {
this.queryParameters.replaceValues(String.format("ipnetworklist[%d].ip", count), ImmutableSet.of(ip));
this.queryParameters.replaceValues(String.format("ipnetworklist[%d].networkid", count),
this.queryParameters.replaceValues(String.format("iptonetworklist[%d].ip", count), ImmutableSet.of(ip));
this.queryParameters.replaceValues(String.format("iptonetworklist[%d].networkid", count),
ImmutableSet.of("" + ipsToNetworks.get(ip)));
count += 1;
}