diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java index 95e4d8fa79..c72e6a2db1 100644 --- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java +++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java @@ -49,13 +49,14 @@ import com.google.common.collect.ImmutableSet; @Singleton public class VirtualGuestToNodeMetadata implements Function { + //TODO: There may be more states than this. public static final Map serverStateToNodeState = ImmutableMap - . builder().put(VirtualGuest.State.RUNNING, NodeState.RUNNING)// - .put(VirtualGuest.State.STARTING, NodeState.PENDING)// - .put(VirtualGuest.State.DESTROYED, NodeState.TERMINATED)// - // TODO other states - .put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED)// - .build(); + . builder() + .put(VirtualGuest.State.RUNNING, NodeState.RUNNING) + .put(VirtualGuest.State.PAUSED, NodeState.SUSPENDED) + .put(VirtualGuest.State.HALTED, NodeState.PENDING) + .put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED) + .build(); private final FindHardwareForVirtualGuest findHardwareForVirtualGuest; private final FindLocationForVirtualGuest findLocationForVirtualGuest; diff --git a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java index acc2350738..eb41998cf5 100644 --- a/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java +++ b/sandbox-providers/softlayer/src/main/java/org/jclouds/softlayer/domain/VirtualGuest.java @@ -204,8 +204,17 @@ public class VirtualGuest implements Comparable { } } + /** + * TBD: These states come from the powerState field. i.e. + * https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests/{id}?objectMask=powerState + */ public static enum State { - STARTING, RUNNING, STOPPING, STOPPED, DESTROYED, EXPUNGING, MIGRATING, ERROR, UNKNOWN, SHUTDOWNED, UNRECOGNIZED; + //ACTIVE, // Get this from https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/{id}/getStatus + PAUSED, + RUNNING, + HALTED, + UNRECOGNIZED; + @Override public String toString() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); @@ -218,7 +227,6 @@ public class VirtualGuest implements Comparable { return UNRECOGNIZED; } } - } private int accountId = -1;