1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

fix(networks, storages): a name in use is refused by the page again

The create forms of networks and storage pools checked the new name
against the host's list of networks or pools, but that list holds one
dict per object, so the name never matched and the check never fired;
libvirt refused the duplicate with its own wording. The check now
compares names: the page shows its own message, nothing is sent to
libvirt, and the Logs page gets a failed row "...: add: name already
in use".
This commit is contained in:
catborise 2026-10-23 13:32:08 +03:00
parent 1eaa3524d5
commit d5df187de4
4 changed files with 13 additions and 14 deletions

View file

@ -86,8 +86,6 @@ class NetworkRowTests(TestCase):
self.client.post(url, {"create": "", "name": "audit-net", "forward": "nat", "subnet": "198.51.100.0/24",
"dhcp4": "on"})
self.client.post(url, {"create": "", "name": "bad name!", "forward": "nat"}) # invalid form
self.client.post(url, {"create": "", "name": "lab", "forward": "nat", "subnet": "203.0.113.0/24"})
[first, second] = rows()
self.assertEqual(first, ("Network audit-net: add", True))
self.assertFalse(second[1])
self.assertTrue(second[0].startswith("Network lab: add: "), second[0])
response = self.client.post(url, {"create": "", "name": "lab", "forward": "nat", "subnet": "203.0.113.0/24"})
self.assertIn("Network pool name already in use", [str(m) for m in get_messages(response.wsgi_request)])
self.assertEqual(rows(), [("Network audit-net: add", True), ("Network lab: add: name already in use", False)])