[haizea-commit] r770 - branches/1.1/src/haizea/core/scheduler

haizea-commit at mailman.cs.uchicago.edu haizea-commit at mailman.cs.uchicago.edu
Fri Jan 15 05:34:30 CST 2010


Author: borja
Date: 2010-01-15 05:34:27 -0600 (Fri, 15 Jan 2010)
New Revision: 770

Modified:
   branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
Log:
Determining if a lease can be suspended should also take into account the current time.

Modified: branches/1.1/src/haizea/core/scheduler/vm_scheduler.py
===================================================================
--- branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-15 10:13:50 UTC (rev 769)
+++ branches/1.1/src/haizea/core/scheduler/vm_scheduler.py	2010-01-15 11:34:27 UTC (rev 770)
@@ -244,7 +244,7 @@
         self.slottable.remove_reservation(vmrr)
 
 
-    def can_suspend_at(self, lease, t):
+    def can_suspend_at(self, lease, t, nexttime=None):
         """ Determines if it is possible to suspend a lease before a given time
 
         Arguments:
@@ -252,7 +252,10 @@
         t -- Time by which the VM must be preempted
         """
         vmrr = lease.get_vmrr_at(t)
-        time_until_suspend = t - vmrr.start
+        if nexttime == None:
+            time_until_suspend = t - vmrr.start
+        else:
+            time_until_suspend = min( (t - vmrr.start, t - nexttime))
         min_duration = self.__compute_scheduling_threshold(lease)
         can_suspend = time_until_suspend >= min_duration        
         return can_suspend



More information about the Haizea-commit mailing list