feat: spread cluster VMs without a fixed host over the cluster hosts

VMs assigned only to a cluster now count towards every host of that
cluster in proportion to its size: vCPUs by threads, memory by host RAM,
evenly if no host has CPU & RAM recorded. The cluster host table and the
CPU & RAM tab of a host include this share; the cluster totals still
count each VM once. Hosts are matched by device ID instead of name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-29 11:02:35 +01:00
1 parent 675574ee00
commit afa15eb46a
8 files changed
+156 -21

No files matched your search

@@ -27,7 +27,10 @@
</td>
<td>{% if row.host.cores %}{{ row.host.cores }} / {{ row.host.threads }}{% else %}—{% endif %}</td>
<td>{{ row.memory }}</td>
<td>{{ row.host.vm_count }} <span class="text-muted small">({{ row.host.vcpus|floatformat:"-1" }} vCPU, {{ row.vm_memory }})</span></td>
<td>
{{ row.host.vm_count }}{% if row.host.shared_vcpus or row.host.shared_memory_gb %} <span class="text-muted small">+ anteilig</span>{% endif %}
<div class="text-muted small">{{ row.host.total_vcpus|floatformat:"-1" }} vCPU, {{ row.vm_memory }}</div>
</td>
<td>{{ row.vcpu_per_core }}</td>
<td>
{% if row.memory_percent is not None %}
@@ -42,7 +45,8 @@
</div>
</div>
<div class="card-footer small text-muted">
Gezählt werden alle VMs außer „Offline“ und „Außer Betrieb“. VMs ohne festen Host zählen nur zur Cluster-Summe.
Gezählt werden alle VMs außer „Offline“ und „Außer Betrieb“. VMs ohne festen Host werden anteilig nach Größe
auf die Hosts verteilt: vCPUs nach Threads, RAM nach Host-RAM. Ist bei keinem Host CPU/RAM erfasst, zu gleichen Teilen.
</div>
{% endif %}
</div>
@@ -64,6 +64,12 @@
{% else %}
<div class="card-body text-muted">Keine VMs mit diesem Gerät als Host.</div>
{% endif %}
{% if capacity.host_share and capacity.unplaced_vm_count %}
<div class="card-footer small text-muted">
Die Liste zeigt nur VMs, deren Gerät dieser Host ist. {{ capacity.unplaced_vm_count }} weitere VM{{ capacity.unplaced_vm_count|pluralize:",s" }}
des Clusters ohne festen Host {{ capacity.unplaced_vm_count|pluralize:"ist,sind" }} anteilig in der Auslastung enthalten.
</div>
{% endif %}
</div>
{% endif %}
{% endblock content %}
@@ -14,7 +14,13 @@
<th scope="row">VMs</th>
<td>
{{ capacity.vm_count }} VM{{ capacity.vm_count|pluralize:",s" }} · {{ capacity.vcpus|floatformat:"-1" }} vCPUs · {{ vm_memory }} RAM
{% if capacity.unplaced_vm_count %}<div class="small text-muted">davon {{ capacity.unplaced_vm_count }} ohne festen Host</div>{% endif %}
{% if capacity.host_share and capacity.unplaced_vm_count %}
<div class="small text-muted">
inkl. anteiliger Last aus {{ capacity.unplaced_vm_count }} Cluster-VM{{ capacity.unplaced_vm_count|pluralize:",s" }} ohne festen Host
</div>
{% elif capacity.unplaced_vm_count %}
<div class="small text-muted">davon {{ capacity.unplaced_vm_count }} ohne festen Host, anteilig nach Größe auf die Hosts verteilt</div>
{% endif %}
</td>
</tr>
<tr>