mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(instances): every end of a migration job leaves a Logs row
Only migrate_instance, inside the job's run, wrote the migration's row: a migration refused by precheck, cancelled while queued, or ended by recovery after a worker restart left none. The job now has a log entry for the ends migrate_instance did not log; run marks those it did.
This commit is contained in:
parent
62976cbd55
commit
1089b914ed
2 changed files with 26 additions and 1 deletions
|
|
@ -213,3 +213,18 @@ class MigrateJobTestCase(TransactionTestCase):
|
|||
proxy.return_value.instance.isActive.return_value = False
|
||||
get_kind(op.kind).cancel(op)
|
||||
proxy.return_value.instance.abortJob.assert_not_called()
|
||||
|
||||
def test_each_end_of_a_migration_leaves_one_logs_row(self):
|
||||
from logs.models import Logs
|
||||
|
||||
op = self.queue(live_migrate="true")
|
||||
ctx = self.start(op)
|
||||
get_kind(op.kind).run(op, ctx) # migrate_instance writes its row
|
||||
op.refresh_from_db()
|
||||
self.assertIsNone(MigrateInstance().log_entry(op, Operation.SUCCEEDED))
|
||||
self.assertEqual(Logs.objects.filter(instance_uuid=UUID).count(), 1)
|
||||
# ended without migrate_instance: refused, cancelled while queued, or by recovery
|
||||
queued = Operation(params={"instance": self.vm.pk, "target": self.dest.pk}, intent={"uuid": UUID},
|
||||
resource_label="mig-src/mig-vm")
|
||||
self.assertEqual(MigrateInstance().log_entry(queued, Operation.CANCELLED),
|
||||
("mig-src", "mig-vm", UUID, "VM mig-vm: migrate to mig-dst (cancelled)"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue