Issue 158: Tidy up VirtualGuest.State after feedback from Softlayer

This commit is contained in:
Jason King 2011-09-26 10:17:17 +01:00
parent 81796319aa
commit 7894d830bf
2 changed files with 7 additions and 9 deletions

View File

@ -49,12 +49,11 @@ import com.google.common.collect.ImmutableSet;
@Singleton @Singleton
public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMetadata> { public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMetadata> {
//TODO: There may be more states than this.
public static final Map<VirtualGuest.State, NodeState> serverStateToNodeState = ImmutableMap public static final Map<VirtualGuest.State, NodeState> serverStateToNodeState = ImmutableMap
.<VirtualGuest.State, NodeState> builder() .<VirtualGuest.State, NodeState> builder()
.put(VirtualGuest.State.RUNNING, NodeState.RUNNING)
.put(VirtualGuest.State.PAUSED, NodeState.SUSPENDED)
.put(VirtualGuest.State.HALTED, NodeState.PENDING) .put(VirtualGuest.State.HALTED, NodeState.PENDING)
.put(VirtualGuest.State.PAUSED, NodeState.SUSPENDED)
.put(VirtualGuest.State.RUNNING, NodeState.RUNNING)
.put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED) .put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED)
.build(); .build();

View File

@ -205,14 +205,13 @@ public class VirtualGuest implements Comparable<VirtualGuest> {
} }
/** /**
* 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 * https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests/{id}?objectMask=powerState
*/ */
public static enum State { public static enum State {
//ACTIVE, // Get this from https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/{id}/getStatus HALTED,
PAUSED, PAUSED,
RUNNING, RUNNING,
HALTED,
UNRECOGNIZED; UNRECOGNIZED;
@Override @Override