diff --git a/lib/config.py b/lib/config.py index 6860569e2ac40a6506ce1a3d30f93a19448b6cb0..665c15cb1a2632593d8a1830e858fb3a3fb12414 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 6666a80ca185f76b920729af3f1ec2267e99ce99..0713aee938c2e6aac9f18e0b41d0e70cf57bc1d7 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)