1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 04:36:48 +00:00

fix(logs): a row says what happened: a recovered migration, a failed clone step, a device not there

- A migration whose libvirt call failed but which recovery finds moved (or
  cannot tell) gets a row of that end; only a failure already logged by
  migrate_instance is not logged twice.
- A clone made with its resize or start failed, and a recovered migration
  whose autostart or NVRAM step failed, write a failed row of that step, as
  migrate_instance does for its later steps.
- Setting the link state of an interface or the video model of a VM that
  has none is refused: it changed nothing and was logged as done.
- The rows of a removed VM record (deleted or expired) name its host, VM
  and UUID, so the VM's history has them.
This commit is contained in:
catborise 2026-11-07 14:22:47 +03:00
parent 470cc9860e
commit 528b4492f6
14 changed files with 390 additions and 304 deletions

View file

@ -109,7 +109,7 @@ class OwnershipTestCase(TestCase):
self.assertEqual(self.ownership(self.host_a), (False, []))
self.assertFalse(InstanceTombstone.objects.exists())
self.assertIn(("-", "-", f"VM vm ({UUID}): removed record expired"), self.rows())
self.assertIn(("-", "host-a", f"VM vm ({UUID}): removed record expired"), self.rows())
@override_settings(INSTANCE_OWNERSHIP_RETENTION_DAYS=30)
def test_a_removed_record_expires_while_nothing_changes(self):
@ -120,7 +120,9 @@ class OwnershipTestCase(TestCase):
refresh_instance_database(self.host_b) # its VMs match the database
self.assertFalse(InstanceTombstone.objects.exists())
self.assertIn(("-", "-", f"VM vm ({UUID}): removed record expired"), self.rows())
# the VM's history (found by UUID) has it
self.assertTrue(Logs.objects.filter(instance_uuid=UUID, instance="vm", message__endswith="expired").exists())
self.assertIn(("-", "host-a", f"VM vm ({UUID}): removed record expired"), self.rows())
def test_deleted_users_are_skipped(self):
self.owned_vm(self.host_a)