Issue 158: Put in node states seen in the powerState field and mapped to JClouds states

This commit is contained in:
Jason King 2011-09-23 16:54:13 +01:00
parent a4a771fb8c
commit 90edc423a8
2 changed files with 17 additions and 8 deletions

View File

@ -49,13 +49,14 @@ 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().put(VirtualGuest.State.RUNNING, NodeState.RUNNING)// .<VirtualGuest.State, NodeState> builder()
.put(VirtualGuest.State.STARTING, NodeState.PENDING)// .put(VirtualGuest.State.RUNNING, NodeState.RUNNING)
.put(VirtualGuest.State.DESTROYED, NodeState.TERMINATED)// .put(VirtualGuest.State.PAUSED, NodeState.SUSPENDED)
// TODO other states .put(VirtualGuest.State.HALTED, NodeState.PENDING)
.put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED)// .put(VirtualGuest.State.UNRECOGNIZED, NodeState.UNRECOGNIZED)
.build(); .build();
private final FindHardwareForVirtualGuest findHardwareForVirtualGuest; private final FindHardwareForVirtualGuest findHardwareForVirtualGuest;
private final FindLocationForVirtualGuest findLocationForVirtualGuest; private final FindLocationForVirtualGuest findLocationForVirtualGuest;

View File

@ -204,8 +204,17 @@ public class VirtualGuest implements Comparable<VirtualGuest> {
} }
} }
/**
* 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 { 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 @Override
public String toString() { public String toString() {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()); return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
@ -218,7 +227,6 @@ public class VirtualGuest implements Comparable<VirtualGuest> {
return UNRECOGNIZED; return UNRECOGNIZED;
} }
} }
} }
private int accountId = -1; private int accountId = -1;