From 7894d830bf50e31e9569d37e348b8f3fa6281931 Mon Sep 17 00:00:00 2001 From: Jason King Date: Mon, 26 Sep 2011 10:17:17 +0100 Subject: [PATCH] Issue 158: Tidy up VirtualGuest.State after feedback from Softlayer --- .../compute/functions/VirtualGuestToNodeMetadata.java | 11 +++++------ .../org/jclouds/softlayer/domain/VirtualGuest.java | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) 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 c72e6a2db1..052aa8dab9 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,14 +49,13 @@ 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.PAUSED, NodeState.SUSPENDED) - .put(VirtualGuest.State.HALTED, NodeState.PENDING) - .put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED) - .build(); + .put(VirtualGuest.State.HALTED, NodeState.PENDING) + .put(VirtualGuest.State.PAUSED, NodeState.SUSPENDED) + .put(VirtualGuest.State.RUNNING, NodeState.RUNNING) + .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 eb41998cf5..05855c761b 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 @@ -205,14 +205,13 @@ public class VirtualGuest implements Comparable { } /** - * TBD: These states come from the powerState field. i.e. + * 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 { - //ACTIVE, // Get this from https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/{id}/getStatus + HALTED, PAUSED, RUNNING, - HALTED, UNRECOGNIZED; @Override