From 7306471459ab8d92cc3504609921a4c176ad78af Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Tue, 27 Oct 2009 13:53:03 -0400 Subject: [PATCH] Add config.DropECReservations 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 | 8 ++++++++ lib/mcpu.py | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/config.py b/lib/config.py index 6860569e2..665c15cb1 100644 --- a/lib/config.py +++ b/lib/config.py @@ -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 + diff --git a/lib/mcpu.py b/lib/mcpu.py index 6666a80ca..0713aee93 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -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) -- GitLab