mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 12:16:49 +00:00
refactor(computes): the Computes page reads capacity through vrtManager
The capacity read lived in its own module with raw libvirt calls and a thread pool with a deadline, beside helpers that already read the same things. It now uses them: - wvmHostDetails.get_capacity() sums the vCPUs and memory of all and of the running VMs from get_host_instances(), against the host's info. - get_storages_info() also gives each pool's free space. - Compute.capacity joins the two, like cpu_count and ram_size, and is None when the host is down or the read fails. The page reads the hosts one after another, as it already connected to each of them; a host that cannot be reached is given up after the connect timeout. computes/capacity.py and its thread handling are gone. The page looks and sorts as before.
This commit is contained in:
parent
1436ed13af
commit
d9f9ebab58
8 changed files with 114 additions and 185 deletions
|
|
@ -14,7 +14,7 @@ class wvmStorages(wvmConnect):
|
|||
stg_status = stg.isActive()
|
||||
stg_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type")
|
||||
stg_vol = len(stg.listVolumes()) if stg_status else None
|
||||
stg_size = stg.info()[1]
|
||||
_state, stg_size, _allocation, stg_free = stg.info()
|
||||
storages.append(
|
||||
{
|
||||
"name": pool,
|
||||
|
|
@ -22,6 +22,7 @@ class wvmStorages(wvmConnect):
|
|||
"type": stg_type,
|
||||
"volumes": stg_vol,
|
||||
"size": stg_size,
|
||||
"free": stg_free,
|
||||
}
|
||||
)
|
||||
return storages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue