mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(jobs): a cancel reaches libvirt for a job that recovery watches
The worker sends cancels only to jobs its own threads run. After a worker restart, a migration or live clone that libvirt still ran was watched by recovery; a cancel then moved the job to cancelling, the page said so, but nothing told libvirt, and the job ran to its end. Recovery now sends the cancel once while libvirt still runs the job, and a migration it aborted ends cancelled rather than failed.
This commit is contained in:
parent
37f97f4e79
commit
30f5bf6535
4 changed files with 28 additions and 0 deletions
|
|
@ -70,6 +70,10 @@ class MigrateJobTestCase(TransactionTestCase):
|
|||
dom.isActive.return_value = False
|
||||
with patch("instances.jobs._domain", side_effect=[dom, None]): # source, destination
|
||||
self.assertEqual(MigrateInstance().reconcile(op).state, Operation.FAILED)
|
||||
op.cancel_requested = True # recovery sent the cancel: libvirt aborted it
|
||||
with patch("instances.jobs._domain", side_effect=[dom, None]):
|
||||
self.assertEqual(MigrateInstance().reconcile(op).state, Operation.CANCELLED)
|
||||
op.cancel_requested = False
|
||||
dom.isActive.return_value = True
|
||||
dom.jobInfo.return_value = [2] + [0] * 11 # VIR_DOMAIN_JOB_UNBOUNDED
|
||||
with patch("instances.jobs._domain", side_effect=[dom, dom]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue