mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 20:26:48 +00:00
feat(computes): the host overview shows its VMs, capacity and load, also when it cannot be reached
A host the panel could not reach made its overview the 500 page, without the host's sections, and the Computes list gave such a host an Overview button that led nowhere. The page now keeps the host's name, sections, "Edit connection" and "Remove from panel" (the existing confirmation), and says "Not connected" with the reason and a "Try again". Details that cannot be read are said in an alert; the VMs, capacity and load still show, as they are read on their own. A reachable host's page leads with what it runs and what it gave: - its VMs by state (running, shut off, paused, other), linked to Instances; - the vCPUs, memory and storage pools given, as on the Computes list, which now shares those parts (computes/capacity_*.html) and their preparation (views.shown_capacity) with it; - CPU and memory in use, side by side, with the current reading in words, a note on what the charts hold and when they were last updated, or since when not; memory in GB like the rest of the page; - Hardware and Software and connection: logical CPUs and clock from virNodeGetInfo, but physical cores, sockets and NUMA nodes counted from the CPUs of the capabilities' NUMA cells, as virNodeGetInfo makes a topology up for hosts it cannot describe (asymmetric NUMA); the hypervisor's own name and version, libvirt, emulator, the guest architectures as text instead of menus of dead links. A host without sysinfo shows no processor instead of failing. Empty notes no longer show "None"; labels stack over their values on a phone instead of running into them. Pools that cannot be read no longer drop a host's vCPUs and memory from its capacity: the storage part says so. get_capacity also counts the VMs by state.
This commit is contained in:
parent
86c708ed68
commit
1b99d2eac5
15 changed files with 487 additions and 201 deletions
|
|
@ -91,18 +91,22 @@ class Compute(Model):
|
|||
@cached_property
|
||||
def capacity(self):
|
||||
"""What the host has given its VMs (wvmHostDetails.get_capacity), its
|
||||
vCPUs per CPU, and its active storage pools, the default one first; or
|
||||
None when it cannot be read."""
|
||||
vCPUs per CPU, and its active storage pools, the default one first
|
||||
(None when the pools cannot be read); or None when the host cannot be
|
||||
read."""
|
||||
if self.status is not True:
|
||||
return None
|
||||
try:
|
||||
given = self.proxy.get_capacity()
|
||||
storages = wvmStorages(self.hostname, self.login, self.password, self.type)
|
||||
pools = [pool for pool in storages.get_storages_info() if pool["status"]]
|
||||
except libvirtError:
|
||||
return None
|
||||
given["ratio"] = given["vcpus"]["all"] / given["cpus"] if given["cpus"] else 0
|
||||
given["pools"] = sorted(pools, key=lambda pool: (pool["name"] != "default", pool["name"]))
|
||||
try:
|
||||
storages = wvmStorages(self.hostname, self.login, self.password, self.type)
|
||||
pools = [pool for pool in storages.get_storages_info() if pool["status"]]
|
||||
given["pools"] = sorted(pools, key=lambda pool: (pool["name"] != "default", pool["name"]))
|
||||
except libvirtError:
|
||||
given["pools"] = None
|
||||
return given
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue