LGTM, thanks

On Wed, Jun 4, 2014 at 10:20 AM, 'Klaus Aehlig' via ganeti-devel <
[email protected]> wrote:

> ...when waiting for a lock. This will ensure that the more
> important jobs are preferred over the less important ones.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  lib/mcpu.py | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/lib/mcpu.py b/lib/mcpu.py
> index 33fd50d..4b0a28e 100644
> --- a/lib/mcpu.py
> +++ b/lib/mcpu.py
> @@ -352,12 +352,14 @@ class Processor(object):
>      """
>      self._CheckLocksEnabled()
>
> -    # TODO: honor priority in lock allocation
>      if self._cbs:
>        priority = self._cbs.CurrentPriority() # pylint: disable=W0612
>      else:
>        priority = None
>
> +    if priority is None:
> +      priority = constants.OP_PRIO_DEFAULT
> +
>      if names == locking.ALL_SET:
>        if opportunistic:
>          expand_fns = {
> @@ -395,8 +397,8 @@ class Processor(object):
>        locks =
> self.wconfd.Client().OpportunisticLockUnion(self._wconfdcontext,
>                                                            request)
>      elif timeout is None:
> -      # TODO: use correct priority instead of 0
> -      self.wconfd.Client().UpdateLocksWaiting(self._wconfdcontext, 0,
> request)
> +      self.wconfd.Client().UpdateLocksWaiting(self._wconfdcontext,
> priority,
> +                                              request)
>        while True:
>          pending =
> self.wconfd.Client().HasPendingRequest(self._wconfdcontext)
>          if not pending:
> @@ -406,7 +408,8 @@ class Processor(object):
>        logging.debug("Trying %ss to request %s for %s",
>                      timeout, request, self._wconfdcontext)
>        # TODO: use correct priority instead of 0
> -      self.wconfd.Client().UpdateLocksWaiting(self._wconfdcontext, 0,
> request)
> +      self.wconfd.Client().UpdateLocksWaiting(self._wconfdcontext,
> priority,
> +                                              request)
>        pending = utils.SimpleRetry(False,
> self.wconfd.Client().HasPendingRequest,
>                                    1.0, timeout,
> args=[self._wconfdcontext])
>        if pending:
> --
> 1.9.1.423.g4596e3a
>
>

Reply via email to