Commit 42e32075 authored by Iustin Pop's avatar Iustin Pop
Browse files

Merge branch 'devel-2.2'



* devel-2.2:
  Fix case of MAC special-values
  Remove mcpu's ReportLocks callback
  Revert "jqueue: Resume jobs from “waitlock” status"

(no conflicts, took LGTM from original commit)
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parents 31684f84 8341ec93
......@@ -491,10 +491,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,
......@@ -969,11 +967,11 @@ class JobQueue(object):
status = job.CalcStatus()
if status in (constants.JOB_STATUS_QUEUED,
constants.JOB_STATUS_WAITLOCK):
if status in (constants.JOB_STATUS_QUEUED, ):
self._wpool.AddTask((job, ))
elif status in (constants.JOB_STATUS_RUNNING,
constants.JOB_STATUS_WAITLOCK,
constants.JOB_STATUS_CANCELING):
logging.warning("Unfinished job %s found: %s", job.id, job)
job.MarkUnfinishedOps(constants.OP_STATUS_ERROR,
......
......@@ -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):
......
......@@ -214,9 +214,8 @@
<varlistentry>
<term>mac</term>
<listitem>
<simpara>either a value or <constant>GENERATE</constant>
to generate a new unique MAC, or
<constant>AUTO</constant> to reuse the old MAC</simpara>
<simpara>either a value or 'generate' to generate a new
unique MAC, or 'auto' to reuse the old MAC</simpara>
</listitem>
</varlistentry>
<varlistentry>
......
......@@ -200,8 +200,8 @@
<varlistentry>
<term>mac</term>
<listitem>
<simpara>either a value or <constant>GENERATE</constant>
to generate a new unique MAC</simpara>
<simpara>either a value or 'generate' to generate a
new unique MAC</simpara>
</listitem>
</varlistentry>
<varlistentry>
......
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