Commit 163c51e4 authored by Anton Beloglazov's avatar Anton Beloglazov

- Added handling null migrationMap

parent ef051eb2
...@@ -147,6 +147,7 @@ public class PowerDatacenter extends Datacenter { ...@@ -147,6 +147,7 @@ public class PowerDatacenter extends Datacenter {
if (!isDisableMigrations()) { if (!isDisableMigrations()) {
List<Map<String, Object>> migrationMap = getVmAllocationPolicy().optimizeAllocation(getVmList()); List<Map<String, Object>> migrationMap = getVmAllocationPolicy().optimizeAllocation(getVmList());
if (migrationMap != null) {
for (Map<String, Object> migrate : migrationMap) { for (Map<String, Object> migrate : migrationMap) {
Vm vm = (Vm) migrate.get("vm"); Vm vm = (Vm) migrate.get("vm");
PowerHost targetHost = (PowerHost) migrate.get("host"); PowerHost targetHost = (PowerHost) migrate.get("host");
...@@ -168,6 +169,7 @@ public class PowerDatacenter extends Datacenter { ...@@ -168,6 +169,7 @@ public class PowerDatacenter extends Datacenter {
send(getId(), vm.getRam() / ((double) vm.getBw() / 8000) + 0, CloudSimTags.VM_MIGRATE, migrate); send(getId(), vm.getRam() / ((double) vm.getBw() / 8000) + 0, CloudSimTags.VM_MIGRATE, migrate);
} }
} }
}
// schedules an event to the next time // schedules an event to the next time
if (minTime != Double.MAX_VALUE) { if (minTime != Double.MAX_VALUE) {
......
...@@ -121,6 +121,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter { ...@@ -121,6 +121,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
if (!isDisableMigrations()) { if (!isDisableMigrations()) {
List<Map<String, Object>> migrationMap = getVmAllocationPolicy().optimizeAllocation(getVmList()); List<Map<String, Object>> migrationMap = getVmAllocationPolicy().optimizeAllocation(getVmList());
if (migrationMap != null) {
for (Map<String, Object> migrate : migrationMap) { for (Map<String, Object> migrate : migrationMap) {
Vm vm = (Vm) migrate.get("vm"); Vm vm = (Vm) migrate.get("vm");
PowerHost targetHost = (PowerHost) migrate.get("host"); PowerHost targetHost = (PowerHost) migrate.get("host");
...@@ -142,6 +143,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter { ...@@ -142,6 +143,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
send(getId(), vm.getRam() / ((double) vm.getBw() / 8000) + 10, CloudSimTags.VM_MIGRATE, migrate); send(getId(), vm.getRam() / ((double) vm.getBw() / 8000) + 10, CloudSimTags.VM_MIGRATE, migrate);
} }
} }
}
// schedules an event to the next time // schedules an event to the next time
if (minTime != Double.MAX_VALUE) { if (minTime != Double.MAX_VALUE) {
......
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