Commit cee32223 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Merge branch 'devel-2.3'



* devel-2.3:
  Fix typo in gnt-instance manpage
  jqueue: Fix cancelling while in waitlock in queue
  cli: Extend message for LUXI timeouts
  Fix timeout handling in LUXI client

Conflicts:
	man/gnt-instance.sgml: Trivial merge in gnt-instance.rst
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parents 2a0f9372 ab737f24
......@@ -1844,8 +1844,11 @@ def FormatError(err):
obuf.write("Cannot communicate with the master daemon.\nIs it running"
" and listening for connections?")
elif isinstance(err, luxi.TimeoutError):
obuf.write("Timeout while talking to the master daemon. Error:\n"
"%s" % msg)
obuf.write("Timeout while talking to the master daemon. Jobs might have"
" been submitted and will continue to run even if the call"
" timed out. Useful commands in this situation are \"gnt-job"
" list\", \"gnt-job cancel\" and \"gnt-job watch\". Error:\n")
obuf.write(msg)
elif isinstance(err, luxi.PermissionError):
obuf.write("It seems you don't have permissions to connect to the"
" master daemon.\nPlease retry as a different user.")
......
......@@ -990,17 +990,23 @@ class _JobProcessor(object):
# Consistency check
assert compat.all(i.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_CANCELING,
constants.OP_STATUS_CANCELED)
for i in job.ops[opctx.index + 1:])
assert op.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_WAITLOCK,
constants.OP_STATUS_CANCELING,
constants.OP_STATUS_CANCELED)
assert (op.priority <= constants.OP_PRIO_LOWEST and
op.priority >= constants.OP_PRIO_HIGHEST)
if op.status != constants.OP_STATUS_CANCELED:
if op.status not in (constants.OP_STATUS_CANCELING,
constants.OP_STATUS_CANCELED):
assert op.status in (constants.OP_STATUS_QUEUED,
constants.OP_STATUS_WAITLOCK)
# Prepare to start opcode
if self._MarkWaitlock(job, op):
# Write to disk
......
......@@ -232,12 +232,12 @@ class Transport:
while True:
try:
data = self.socket.recv(4096)
except socket.timeout, err:
raise TimeoutError("Receive timeout: %s" % str(err))
except socket.error, err:
if err.args and err.args[0] == errno.EAGAIN:
continue
raise
except socket.timeout, err:
raise TimeoutError("Receive timeout: %s" % str(err))
break
if not data:
raise ConnectionClosedError("Connection closed while reading")
......
......@@ -852,7 +852,7 @@ MODIFY
| [--disk add:size=*SIZE*[,vg=*VG*] \| --disk remove \|
| --disk *N*:mode=*MODE*]
| [-t plain | -t drbd -n *new_secondary*]
| [--os-name=*OS* [--force-variant]]
| [--os-type=*OS* [--force-variant]]
| [--submit]
| {*instance*}
......@@ -884,7 +884,7 @@ instance. The available options are the same as in the **add** command
of the instance, while the ``--net`` *N*:*options* option will
change the parameters of the Nth instance NIC.
The option ``--os-name`` will change the OS name for the instance
The option ``--os-type`` will change the OS name for the instance
(without reinstallation). In case an OS variant is specified that
is not found, then by default the modification is refused, unless
``--force-variant`` is passed. An invalid OS will also be refused,
......
......@@ -669,7 +669,48 @@ class TestJobProcessor(unittest.TestCase, _JobProcessorTestUtils):
for op in job.ops))
opexec = _FakeExecOpCodeForProc(queue, None, None)
jqueue._JobProcessor(queue, opexec, job)()
self.assert_(jqueue._JobProcessor(queue, opexec, job)())
# Check result
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_CANCELED)
self.assertEqual(job.GetInfo(["status"]), [constants.JOB_STATUS_CANCELED])
self.assertFalse(job.start_timestamp)
self.assert_(job.end_timestamp)
self.assertFalse(compat.any(op.start_timestamp or op.end_timestamp
for op in job.ops))
self.assertEqual(job.GetInfo(["opstatus", "opresult"]),
[[constants.OP_STATUS_CANCELED for _ in job.ops],
["Job canceled by request" for _ in job.ops]])
def testCancelWhileWaitlockInQueue(self):
queue = _FakeQueueForProc()
ops = [opcodes.OpTestDummy(result="Res%s" % i, fail=False)
for i in range(5)]
# Create job
job_id = 8645
job = self._CreateJob(queue, job_id, ops)
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_QUEUED)
job.ops[0].status = constants.OP_STATUS_WAITLOCK
assert len(job.ops) == 5
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_WAITLOCK)
# Mark as cancelling
(success, _) = job.Cancel()
self.assert_(success)
self.assertRaises(IndexError, queue.GetNextUpdate)
self.assert_(compat.all(op.status == constants.OP_STATUS_CANCELING
for op in job.ops))
opexec = _FakeExecOpCodeForProc(queue, None, None)
self.assert_(jqueue._JobProcessor(queue, opexec, job)())
# Check result
self.assertEqual(job.CalcStatus(), constants.JOB_STATUS_CANCELED)
......
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