From 122338ba6a698dc5583f661ddf6710b31f0a2b83 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 16 Nov 2011 14:03:29 +0200 Subject: [PATCH] name field isn't always settable, switch to displayName --- .../functions/VirtualMachineToNodeMetadata.java | 2 +- .../strategy/CloudStackComputeServiceAdapter.java | 15 +++++++++------ .../CloudStackComputeServiceAdapterLiveTest.java | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java index b4376272bd..967e245e9f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/compute/functions/VirtualMachineToNodeMetadata.java @@ -96,7 +96,7 @@ public class VirtualMachineToNodeMetadata implements Function 0) { options.securityGroupIds(templateOptions.getSecurityGroupIds()); } else if (templateOptions.getNetworkIds().size() > 0) { options.networkIds(templateOptions.getNetworkIds()); } else if (networks.size() > 0) { try { - options.networkId(getOnlyElement(filter(networks.values(), new Predicate() { + options.networkId(getOnlyElement(filter(networks.values(), and(new Predicate() { @Override public boolean apply(Network arg0) { return arg0.getZoneId() == zoneId && arg0.isDefault(); } - })).getId()); + }, supportsStaticNAT()))).getId()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("please choose a specific network in zone " + zoneId + ": " + networks); } @@ -175,7 +178,7 @@ public class CloudStackComputeServiceAdapter implements public Iterable