1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +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

@ -27,8 +27,18 @@ class wvmStorages(wvmConnect):
)
return storages
def define_storage(self, xml, flag):
self.wvm.storagePoolDefineXML(xml, flag)
def define_storage(self, xml, flags):
"""Define the pool, start it with flags and set it to autostart. A
pool that does not start is undefined again, so its name stays free
for another try."""
stg = self.wvm.storagePoolDefineXML(xml, 0)
try:
stg.create(flags)
except libvirt.libvirtError:
stg.undefine()
raise
stg.setAutostart(1)
return stg
def get_pool_by_target(self, target):
pool_names = self.get_storages()
@ -56,13 +66,8 @@ class wvmStorages(wvmConnect):
<path>{target}</path>
</target>
</pool>"""
self.define_storage(xml, 0)
stg = self.get_storage(name)
# builds the dir pool's directory or the logical pool's volume group
stg.create(libvirt.VIR_STORAGE_POOL_CREATE_WITH_BUILD)
stg.setAutostart(1)
return stg
return self.define_storage(xml, libvirt.VIR_STORAGE_POOL_CREATE_WITH_BUILD)
def create_storage_ceph(
self, stg_type, name, ceph_pool, ceph_host, ceph_user, secret
@ -81,9 +86,6 @@ class wvmStorages(wvmConnect):
</pool>
"""
self.define_storage(xml, 0)
stg = self.get_storage(name)
stg.create(0)
stg.setAutostart(1)
def create_storage_netfs(
self, stg_type, name, netfs_host, source, source_format, target
@ -102,13 +104,8 @@ class wvmStorages(wvmConnect):
</target>
</pool>
"""
self.define_storage(xml, 0)
stg = self.get_storage(name)
# builds the mount point
stg.create(libvirt.VIR_STORAGE_POOL_CREATE_WITH_BUILD)
stg.setAutostart(1)
return stg
return self.define_storage(xml, libvirt.VIR_STORAGE_POOL_CREATE_WITH_BUILD)
class wvmStorage(wvmConnect):