diff --git a/lib/jqueue.py b/lib/jqueue.py index a6c0c7abee3647f3da709a0e78d626fdc88184d6..d7cf580e65598ab52a68a43b130ce9b70d2b1ffd 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -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, diff --git a/lib/mcpu.py b/lib/mcpu.py index 4039d75da2034815f0ed3447c50fa62e72a16468..7248f937866f8013cc98497df0e9e612078db722 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -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): diff --git a/man/gnt-backup.sgml b/man/gnt-backup.sgml index 5992d677f2ab2d1272b0f6d772fc0f1326c48e56..91c495517598907b9097ef38dafa6f2e63277a45 100644 --- a/man/gnt-backup.sgml +++ b/man/gnt-backup.sgml @@ -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> diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml index f4d2f54212f728b0f7d99ea787ee181683b9fe5f..9be66b1b5714fb54164ee9c0f719503a71826f5a 100644 --- a/man/gnt-instance.sgml +++ b/man/gnt-instance.sgml @@ -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>