Permalink
Browse files

refactoring in ResourceAllocation and DataConvert

  • Loading branch information...
1 parent 09fd4c7 commit 24db4671cafe31e0dc0067851994c901edbf2fc0 @pauloricardomg pauloricardomg committed Aug 9, 2010
@@ -263,7 +263,7 @@ public ResourceAllocation getMatchingRA(String name,
"Unknown instance type '" + name + "'");
}
- ra.setPreemptable(spot);
+ ra.setSpotInstance(spot);
ra.setArchitecture(this.cpuArch);
@@ -26,5 +26,5 @@
public void setCpuPercentage(int cpuPercentage);
public void setMemory(int memory);
public void setNodeNumber(int nodeNumber);
- public void setPreemptable(boolean preemptable);
+ public void setSpotInstance(boolean spot);
}
@@ -30,7 +30,7 @@
private int cpuPercentage = -1;
private int memory;
private int nodeNumber;
- private boolean preemptable;
+ private boolean spotInstance;
// -------------------------------------------------------------------------
// implements org.nimbustools.api.repr.vm.ResourceAllocation
@@ -61,8 +61,8 @@ public int getNodeNumber() {
return this.nodeNumber;
}
- public boolean isPreemptable() {
- return preemptable;
+ public boolean isSpotInstance() {
+ return spotInstance;
}
// -------------------------------------------------------------------------
@@ -93,8 +93,8 @@ public void setNodeNumber(int nodeNumber) {
this.nodeNumber = nodeNumber;
}
- public void setPreemptable(boolean preemptable) {
- this.preemptable = preemptable;
+ public void setSpotInstance(boolean preemptable) {
+ this.spotInstance = preemptable;
}
// -------------------------------------------------------------------------
@@ -125,7 +125,7 @@ public int hashCode() {
result = prime * result + indCpuSpeed;
result = prime * result + memory;
result = prime * result + nodeNumber;
- result = prime * result + (preemptable ? 1231 : 1237);
+ result = prime * result + (spotInstance ? 1231 : 1237);
return result;
}
@@ -150,7 +150,7 @@ public boolean equals(Object obj) {
return false;
if (nodeNumber != other.nodeNumber)
return false;
- if (preemptable != other.preemptable)
+ if (spotInstance != other.spotInstance)
return false;
return true;
}
@@ -35,5 +35,5 @@
public int getCpuPercentage();
public int getMemory();
public int getNodeNumber();
- public boolean isPreemptable();
+ public boolean isSpotInstance();
}
@@ -6,7 +6,6 @@
// INSTANCE LIFE CYCLES
// -------------------------------------------------------------------------
- public static final String LIFE_CYCLE_NORMAL = "normal";
public static final String LIFE_CYCLE_SPOT = "spot";
}
@@ -225,8 +225,6 @@ public VM getVM(InstanceResource resource) throws CannotTranslateException {
if(resource.getVM().isPreemptable()){
vm.setLifeCycle(VMConstants.LIFE_CYCLE_SPOT);
- } else {
- vm.setLifeCycle(VMConstants.LIFE_CYCLE_NORMAL);
}
return vm;
@@ -483,7 +481,7 @@ public ResourceAllocation getRA(VirtualMachine vm)
return ra; // *** EARLY RETURN ***
}
- ra.setPreemptable(vm.isPreemptable());
+ ra.setSpotInstance(vm.isPreemptable());
ra.setArchitecture(dep.getCPUArchitecture());
ra.setCpuPercentage(dep.getCPUPercentage());
ra.setIndCpuSpeed(dep.getIndividualCPUSpeed());
@@ -140,7 +140,7 @@ public DefaultBindingAdapter(BindSchedule bindScheduleImpl,
final String name = req.getName();
vm.setName(name);
- vm.setPreemptable(req.getRequestedRA().isPreemptable());
+ vm.setPreemptable(req.getRequestedRA().isSpotInstance());
if (numNodes > 1) {
logger.debug("binding " + numNodes + " virtual machines: " + name);
@@ -89,7 +89,7 @@ private void populate(final _CreateRequest req, int durationSeconds, String name
req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);
ra.setArchitecture(ResourceAllocation.ARCH_x86);
- ra.setPreemptable(preemptable);
+ ra.setSpotInstance(preemptable);
final _RequiredVMM reqVMM = this.repr._newRequiredVMM();
reqVMM.setType("Xen");
reqVMM.setVersions(new String[]{"3"});

0 comments on commit 24db467

Please sign in to comment.