Commit a207c6af authored by Eduardo Falcão's avatar Eduardo Falcão
Browse files

Merge branch 'sla-simulation' of...

Merge branch 'sla-simulation' of git.lsd.ufcg.edu.br:lenovo-autonomic/cloudsimplus into sla-simulation
parents cc949283 795fdfc8
package org.cloudbus.cloudsim.allocationpolicies.migration;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -61,6 +62,7 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
Map<Vm, Host> migrationMap = super.getOptimizedAllocationMap(vmList);
// Consolidate Loose hosts
optimisticConsolidation(migrationMap);
return migrationMap;
}
......@@ -96,8 +98,31 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
return bestCandidateHost;
}
private boolean isTightHost(Host host) {
return host.getIopsProvisioner() instanceof ResourceProvisionerShared;
private Map<Vm, Host> optimisticConsolidation(Map<Vm, Host> actualMigrationMap) {
List<Host> orderedLooseHosts = getOrderedLooseHosts();
for (int i = 0; i < orderedLooseHosts.size(); i++) {
for (int j = orderedLooseHosts.size() - 1; j >= 0; j--) {
if(i == j || orderedLooseHosts.get(i).getVmList().isEmpty())
break;
for (Vm vm : orderedLooseHosts.get(i).getVmList()) {
if(orderedLooseHosts.get(j).isSuitableForVm(vm)) {
actualMigrationMap.put(vm, orderedLooseHosts.get(j));
}
}
}
}
return actualMigrationMap;
}
// Returns the list of loose hosts ordered (increse order) by the number of Vm
private List<Host> getOrderedLooseHosts() {
List<Host> looseHosts = getHostsWithLooseSla();
sort(looseHosts);
Collections.reverse(looseHosts);
return looseHosts;
}
private int getVmsThreshold() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment