Skip to content
Snippets Groups Projects
Commit acf931b7 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Remove mcpu's ReportLocks callback


This is no longer needed with the new lock monitor. One callback is kept to
check for cancelled jobs.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 5ef699a0
No related branches found
No related tags found
No related merge requests found
...@@ -467,10 +467,8 @@ class _OpExecCallbacks(mcpu.OpExecCbBase): ...@@ -467,10 +467,8 @@ class _OpExecCallbacks(mcpu.OpExecCbBase):
timestamp = utils.SplitTime(time.time()) timestamp = utils.SplitTime(time.time())
self._AppendFeedback(timestamp, log_type, log_msg) self._AppendFeedback(timestamp, log_type, log_msg)
def ReportLocks(self, msg): def CheckCancel(self):
"""Write locking information to the job. """Check whether job has been cancelled.
Called whenever the LU processor is waiting for a lock or has acquired one.
""" """
assert self._op.status in (constants.OP_STATUS_WAITLOCK, assert self._op.status in (constants.OP_STATUS_WAITLOCK,
......
...@@ -153,8 +153,8 @@ class OpExecCbBase: # pylint: disable-msg=W0232 ...@@ -153,8 +153,8 @@ class OpExecCbBase: # pylint: disable-msg=W0232
""" """
def ReportLocks(self, msg): def CheckCancel(self):
"""Report lock operations. """Check whether job has been cancelled.
""" """
...@@ -238,59 +238,6 @@ class Processor(object): ...@@ -238,59 +238,6 @@ class Processor(object):
self.rpc = rpc.RpcRunner(context.cfg) self.rpc = rpc.RpcRunner(context.cfg)
self.hmclass = HooksMaster self.hmclass = HooksMaster
def _ReportLocks(self, level, names, shared, timeout, acquired, result):
"""Reports lock operations.
@type level: int
@param level: Lock level
@type names: list or string
@param names: Lock names
@type shared: bool
@param shared: Whether the locks should be acquired in shared mode
@type timeout: None or float
@param timeout: Timeout for acquiring the locks
@type acquired: bool
@param acquired: Whether the locks have already been acquired
@type result: None or set
@param result: Result from L{locking.GanetiLockManager.acquire}
"""
parts = []
# Build message
if acquired:
if result is None:
parts.append("timeout")
else:
parts.append("acquired")
else:
parts.append("waiting")
if timeout is None:
parts.append("blocking")
else:
parts.append("timeout=%0.6fs" % timeout)
parts.append(locking.LEVEL_NAMES[level])
if names == locking.ALL_SET:
parts.append("ALL")
elif isinstance(names, basestring):
parts.append(names)
else:
parts.append(",".join(sorted(names)))
if shared:
parts.append("shared")
else:
parts.append("exclusive")
msg = "/".join(parts)
logging.debug("LU locks %s", msg)
if self._cbs:
self._cbs.ReportLocks(msg)
def _AcquireLocks(self, level, names, shared, timeout): def _AcquireLocks(self, level, names, shared, timeout):
"""Acquires locks via the Ganeti lock manager. """Acquires locks via the Ganeti lock manager.
...@@ -304,13 +251,12 @@ class Processor(object): ...@@ -304,13 +251,12 @@ class Processor(object):
@param timeout: Timeout for acquiring the locks @param timeout: Timeout for acquiring the locks
""" """
self._ReportLocks(level, names, shared, timeout, False, None) if self._cbs:
self._cbs.CheckCancel()
acquired = self.context.glm.acquire(level, names, shared=shared, acquired = self.context.glm.acquire(level, names, shared=shared,
timeout=timeout) timeout=timeout)
self._ReportLocks(level, names, shared, timeout, True, acquired)
return acquired return acquired
def _ExecLU(self, lu): def _ExecLU(self, lu):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment