From fb86273dd9bec2b9d941be994dd926df8eebc43a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 4 Oct 2011 01:17:52 -0700 Subject: [PATCH] filtered out invalid softlayer nodes --- .../strategy/SoftLayerComputeServiceAdapter.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java index c59a539722..f3ff8580a5 100644 --- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java +++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java @@ -65,6 +65,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Splitter; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; import com.google.common.collect.ImmutableSet.Builder; /** @@ -186,7 +187,18 @@ public class SoftLayerComputeServiceAdapter implements @Override public Iterable listNodes() { - return client.getVirtualGuestClient().listVirtualGuests(); + return Iterables.filter(client.getVirtualGuestClient().listVirtualGuests(), new Predicate(){ + + @Override + public boolean apply(VirtualGuest arg0) { + boolean hasBillingItem = arg0.getBillingItemId() != -1; + if (hasBillingItem) + return true; + logger.trace("guest invalid, as it has no billing item %s", arg0); + return false; + } + + }); } @Override