From 896054bf451c60261364e94f7535cc3e2875b0bd Mon Sep 17 00:00:00 2001 From: Stefan Derkits Date: Mon, 24 Jun 2013 23:59:33 +0200 Subject: [PATCH] fix stop Events in SchedB, count start & stop in SchedC --- src/at/ac/tuwien/lsdc/sched/SchedulerB.java | 10 ++++++---- src/at/ac/tuwien/lsdc/sched/SchedulerC.java | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/at/ac/tuwien/lsdc/sched/SchedulerB.java b/src/at/ac/tuwien/lsdc/sched/SchedulerB.java index d2e3e62..9b6225d 100644 --- a/src/at/ac/tuwien/lsdc/sched/SchedulerB.java +++ b/src/at/ac/tuwien/lsdc/sched/SchedulerB.java @@ -57,7 +57,7 @@ public class SchedulerB extends AbstractSchedulerWithMigration { deployed = vm.startApplication(app); if (deployed) { app.setRunningOn(vm); - insertStopEvent(currTime + app.getDuration(), app); + if (current != null) { current.stopApplication(app); current.resizeDown(app); @@ -80,7 +80,7 @@ public class SchedulerB extends AbstractSchedulerWithMigration { vm.resizeDown(evt.getApp()); numStopped ++; - + if (vm.getApplications().size() == 0) { PhysicalMachine pm = vm.getRunningOn(); pm.stopVirtualMachine(vm); @@ -103,7 +103,7 @@ public class SchedulerB extends AbstractSchedulerWithMigration { deployed = false; VirtualMachine vm = null; List sortedPMs = manager.getRevSortedPMs(); - + for (PhysicalMachine pm : sortedPMs) { if (pm.isRunning() && (pm.countCurrentlyRunningVMs() > 0)) { vm = pm.getVirtualMachines().values().iterator().next(); @@ -127,8 +127,10 @@ public class SchedulerB extends AbstractSchedulerWithMigration { } } if (deployed) { + insertStopEvent(currTime + evt.getApp().getDuration(), evt.getApp()); + numStarted ++; - + if(manager.countCurrentlyRunningPMs() < manager.getMaxPMs()) { Application app = federation.askToInsource(); if(app != null) { diff --git a/src/at/ac/tuwien/lsdc/sched/SchedulerC.java b/src/at/ac/tuwien/lsdc/sched/SchedulerC.java index fcf8fe1..0d818f7 100644 --- a/src/at/ac/tuwien/lsdc/sched/SchedulerC.java +++ b/src/at/ac/tuwien/lsdc/sched/SchedulerC.java @@ -53,6 +53,8 @@ public class SchedulerC extends AbstractSchedulerWithMigration { evt.getApp().setRunningOn(null); vm.stopApplication(evt.getApp()); + numStopped++; + if (vm.getApplications().size() == 0) { PhysicalMachine pm = vm.getRunningOn(); pm.stopVirtualMachine(vm); @@ -101,6 +103,8 @@ public class SchedulerC extends AbstractSchedulerWithMigration { if (deployed) { insertStopEvent(currTime + evt.getApp().getDuration(), evt.getApp()); + numStarted++; + if(manager.countCurrentlyRunningPMs() < manager.getMaxPMs()) { Application app = federation.askToInsource(); if(app != null) { -- 2.43.0