Commit acf931b7 authored by Michael Hanselmann's avatar Michael Hanselmann

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
......@@ -467,10 +467,8 @@ class _OpExecCallbacks(mcpu.OpExecCbBase):
timestamp = utils.SplitTime(time.time())
self._AppendFeedback(timestamp, log_type, log_msg)
def ReportLocks(self, msg):
"""Write locking information to the job.
Called whenever the LU processor is waiting for a lock or has acquired one.
def CheckCancel(self):
"""Check whether job has been cancelled.
"""
assert self._op.status in (constants.OP_STATUS_WAITLOCK,
......
......@@ -153,8 +153,8 @@ class OpExecCbBase: # pylint: disable-msg=W0232
"""
def ReportLocks(self, msg):
"""Report lock operations.
def CheckCancel(self):
"""Check whether job has been cancelled.
"""
......@@ -238,59 +238,6 @@ class Processor(object):
self.rpc = rpc.RpcRunner(context.cfg)
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):
"""Acquires locks via the Ganeti lock manager.
......@@ -304,13 +251,12 @@ class Processor(object):
@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,
timeout=timeout)
self._ReportLocks(level, names, shared, timeout, True, acquired)
return acquired
def _ExecLU(self, lu):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment