Skip to content

Commit 5661796

Browse files
committed
Merge pull request Teevity#126 from vfilanovsky/master
Accommodate new EC2 Reserved Instance Model - fixes Teevity#125
2 parents 3afbc71 + 6e0c38e commit 5661796

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/java/com/netflix/ice/processor/Ec2InstanceReservationPrice.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.DataInput;
2828
import java.io.DataOutput;
2929
import java.io.IOException;
30+
import java.util.HashMap;
3031
import java.util.Map;
3132
import java.util.TreeMap;
3233
import java.util.concurrent.ConcurrentSkipListMap;
@@ -234,9 +235,20 @@ public static enum ReservationUtilization {
234235
HEAVY,
235236
FIXED;
236237

238+
static final Map<String, String> reservationTypeMap = new HashMap<String, String>();
239+
static {
240+
reservationTypeMap.put("ALL", "HEAVY");
241+
reservationTypeMap.put("PARTIAL", "MEDIUM");
242+
reservationTypeMap.put("NO", "LIGHT");
243+
}
244+
237245
public static ReservationUtilization get(String offeringType) {
238-
if (offeringType.indexOf(" ") > 0) {
239-
offeringType = offeringType.substring(0, offeringType.indexOf(" ")).toUpperCase();
246+
int idx = offeringType.indexOf(" ");
247+
if (idx > 0) {
248+
offeringType = offeringType.substring(0, idx).toUpperCase();
249+
String mappedValue = reservationTypeMap.get(offeringType);
250+
if (mappedValue != null)
251+
offeringType = mappedValue;
240252
return valueOf(offeringType);
241253
}
242254
else {

0 commit comments

Comments
 (0)