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

fix(storages): pool pages work while a volume is cloned, failed pools are undefined

- libvirt refuses to refresh a pool while a volume is cloned in it. The pool
  page, the volume list of the VM and create pages, upload planning and the
  API no longer fail on that refusal; they use the list libvirt has.
- A new pool that does not start (unreachable NFS server, a device LVM
  cannot use) is undefined again, so the name is free for another try.
- A pool reporting no size, such as an iSCSI pool without LUNs, shows its
  page instead of a division error.
- Each clone dialog shows its own format and metadata rows, so a format
  is never shown without Convert ticked and silently ignored.
- The new-volume size is labelled in GiB and is at least 1; an inactive
  pool shows no "None" volume count.
This commit is contained in:
catborise 2026-10-26 14:18:33 +03:00
parent 9e02286926
commit 63aba5d9c9
9 changed files with 89 additions and 44 deletions

View file

@ -1,9 +1,11 @@
"""The host, pool, user and format values of a new Ceph or NFS pool go into
its XML as text, whatever characters they hold."""
its XML as text, whatever characters they hold; a new pool that does not
start is not left defined."""
from unittest.mock import patch
from django.test import SimpleTestCase
from libvirt import libvirtError
from lxml import etree
from vrtManager.storage import wvmStorages
@ -28,3 +30,13 @@ class PoolXmlTests(SimpleTestCase):
self.assertEqual(pool.find("source/host").get("name"), ODD + "host")
self.assertEqual(pool.find("source/format").get("type"), ODD + "fmt")
self.assertEqual(pool.find("source/dir").get("path"), "/srv/nfs")
def test_a_pool_that_does_not_start_is_undefined(self):
with patch("vrtManager.connection.connection_manager.get_connection") as get:
pool = get.return_value.storagePoolDefineXML.return_value
pool.create.side_effect = libvirtError("mount failed")
with self.assertRaises(libvirtError):
wvmStorages("host", "login", "pw", 1).create_storage_netfs(
"netfs", "pool1", "nfs.example.com", "/srv/nfs", "auto", "/mnt/pool1")
pool.undefine.assert_called_once_with()
pool.setAutostart.assert_not_called()