Add config.DropECReservations
authorGuido Trotter <ultrotter@google.com>
Tue, 27 Oct 2009 17:53:03 +0000 (13:53 -0400)
committerGuido Trotter <ultrotter@google.com>
Fri, 6 Nov 2009 14:08:07 +0000 (14:08 +0000)
For now this function does nothing, but it gets called by mcpu when the
execution of an LU is done, making sure any pending reservations are
dropped.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/config.py
lib/mcpu.py

index 6860569..665c15c 100644 (file)
@@ -1379,3 +1379,11 @@ class ConfigWriter:
         self._temporary_macs.discard(nic.mac)
 
     self._WriteConfig(feedback_fn=feedback_fn)
+
+  @locking.ssynchronized(_config_lock)
+  def DropECReservations(self, ec_id):
+    """Drop per-execution-context reservations
+
+    """
+    pass
+
index 6666a80..0713aee 100644 (file)
@@ -451,8 +451,13 @@ class Processor(object):
             lu.ExpandNames()
             assert lu.needed_locks is not None, "needed_locks not set by LU"
 
-            return self._LockAndExecLU(lu, locking.LEVEL_INSTANCE,
-                                       timeout_strategy.CalcRemainingTimeout)
+            try:
+              return self._LockAndExecLU(lu, locking.LEVEL_INSTANCE,
+                                         timeout_strategy.CalcRemainingTimeout)
+            finally:
+              if self._ec_id:
+                self.context.cfg.DropECReservations(self._ec_id)
+
           finally:
             self.context.glm.release(locking.LEVEL_CLUSTER)