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

fix(instances): internal snapshot names are checked, snapshot dates carry the year

Only external snapshots had their name checked. An internal one could be
taken with an empty name: libvirt named it, the job and its log row named
nothing, and a recovery looked for "" and marked the job failed though the
snapshot existed. Both kinds now pass the same check when queued, and the
internal form asks for a name as the external one does.

Snapshot dates showed no year, so last year's snapshot looked like this
year's in the list one reverts from; they now read 2026-10-13 23:04:00
under "Date (time zone)", as on the Jobs page.
This commit is contained in:
catborise 2026-10-26 12:11:58 +03:00
parent fa84ce8113
commit e29a79c76d
4 changed files with 22 additions and 10 deletions

View file

@ -62,6 +62,13 @@ class SnapshotJobsTestCase(TransactionTestCase):
{"name": "a", "submission_key": "key-snap0001"})
self.assertFalse(Operation.objects.exists())
def test_a_name_that_is_empty_or_not_a_snapshot_name_is_refused_on_the_page(self):
for name in ("", ".hidden", "a b"):
response = self.client.post(reverse("instances:snapshot", args=[self.instance.pk]),
{"name": name, "submission_key": "key-snap0001"}, follow=True)
self.assertContains(response, "Snapshot names are 1-64 letters")
self.assertFalse(Operation.objects.exists())
def test_create_recovery(self):
op = Operation(params={"instance": self.instance.pk, "name": "a", "external": True},
intent={"compute": self.instance.compute_id})