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

+1 -1
View File
@@ -49,7 +49,7 @@ class ClusterCapacityColumn(tables.Column):
from .hardware_views import host_entry, vm_rows
hosts = Device.objects.filter(cluster=record).select_related("netbox_utilities_hardware__cpu")
vms = VirtualMachine.objects.filter(cluster=record).select_related("device")
vms = VirtualMachine.objects.filter(cluster=record)
return build_capacity([host_entry(device) for device in hosts], vm_rows(vms))
def render(self, record):