mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(vmbackups): full audit: backup volumes attached, ended creates, refusals
- A backup's volume is no longer attached to a VM as an existing volume: the VM would write into the backup, and the backup's deletion (by hand or retention) would remove the VM's disk. - A backup whose create job ended without it (uncertain, then resolved) stayed "creating" for good and could not be deleted. Only a backup whose job still runs is being made; the others show as failed and are deleted. - A VM with an NVDIMM or virtio-pmem device is refused: the host file behind it is not copied, and its restore would use the original's file. - A block device's or network NVRAM is refused by its path, instead of a ready backup without the firmware state. - A VM owner's restore pages link back to the VM's Backups tab, not to the superusers' backup list.
This commit is contained in:
parent
e1611efd53
commit
8e0a84a3bd
17 changed files with 375 additions and 305 deletions
|
|
@ -111,11 +111,22 @@ class DeleteBackupTests(TransactionTestCase):
|
|||
self.run_job(op)
|
||||
self.assertEqual(self.removed, [])
|
||||
|
||||
def creating(self, op_state):
|
||||
maker = Operation.objects.create(kind="backup.create", username="del_admin", submission_key="k", resource="r",
|
||||
resource_label="vm1", state=op_state)
|
||||
Backup.objects.filter(pk=self.backup.pk).update(state=Backup.CREATING, operation=maker)
|
||||
|
||||
def test_a_creating_backup_is_not_deleted(self):
|
||||
Backup.objects.filter(pk=self.backup.pk).update(state=Backup.CREATING)
|
||||
self.creating(Operation.RUNNING)
|
||||
with self.assertRaisesMessage(OperationError, "being made"):
|
||||
self.submit()
|
||||
|
||||
def test_a_backup_whose_job_ended_without_it_is_deleted(self):
|
||||
# its job ended uncertain (its host unreachable) and was resolved: the row stays creating
|
||||
self.creating(Operation.FAILED)
|
||||
self.run_job(self.submit())
|
||||
self.assertFalse(Backup.objects.filter(pk=self.backup.pk).exists())
|
||||
|
||||
def test_a_backup_others_build_on_is_refused_until_they_go(self):
|
||||
child = Backup.objects.create(target=self.target, instance=self.vm, vm_uuid=self.vm.uuid, vm_name="vm1",
|
||||
compute_name="h1", state=Backup.READY, parent=self.backup)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue