Files
Netbox-Utilities/netbox_utilities/templates/netbox_utilities/device_hardware.html
T
MrBlakeandClaude Opus 5.5 8aa8d3fe1e fix: do not spread unplaced VMs once a VM of the cluster is pinned
As soon as any VM of a cluster (in any status) is assigned to one of its
hosts, the placement is treated as managed by hand: VMs without a host
are no longer spread over the hosts and only count towards the cluster
totals. Cluster panel and host tab say which case applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 11:12:15 +01:00

76 lines
3.5 KiB
HTML

{% extends 'dcim/device/base.html' %}
{% block content %}
{% if not supported and not record %}
<div class="alert alert-info">
CPU &amp; RAM werden für Geräte mit den konfigurierten Rollen (z. B. Server) und für Cluster-Hosts gepflegt.
</div>
{% endif %}
<div class="row mb-3">
<div class="col col-12 col-xl-6">
<div class="card">
<h2 class="card-header d-flex align-items-center">
<span class="me-auto"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>CPU &amp; RAM</span>
{% if record and can_change %}
<a href="{% url 'plugins:netbox_utilities:devicehardware_edit' pk=record.pk %}?return_url={{ request.path|urlencode }}" class="btn btn-sm btn-outline-secondary">
<i class="mdi mdi-pencil" aria-hidden="true"></i> Bearbeiten
</a>
{% elif not record and can_add %}
<a href="{{ add_url }}" class="btn btn-sm btn-primary"><i class="mdi mdi-plus-thick" aria-hidden="true"></i> Erfassen</a>
{% endif %}
</h2>
{% if record %}
{% include 'netbox_utilities/inc/hardware_record.html' %}
{% else %}
<div class="card-body text-muted">Noch keine CPU und kein RAM erfasst.</div>
{% endif %}
</div>
</div>
<div class="col col-12 col-xl-6">
{% if capacity %}
<div class="card">
<h2 class="card-header d-flex align-items-center">
<span class="me-auto"><i class="mdi mdi-server-network me-1" aria-hidden="true"></i>Virtualisierung</span>
{% if object.cluster %}<a href="{{ object.cluster.get_absolute_url }}" class="btn btn-sm btn-outline-secondary">Cluster {{ object.cluster }}</a>{% endif %}
</h2>
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
</div>
{% endif %}
</div>
</div>
{% if capacity %}
<div class="card">
<h2 class="card-header d-flex align-items-center">
<span class="me-auto">VMs auf diesem Host <span class="badge text-bg-secondary">{{ vms|length }}</span></span>
<a href="{{ vm_list_url }}" class="btn btn-sm btn-outline-secondary">In der VM-Liste öffnen</a>
</h2>
{% if vms %}
<div class="table-responsive">
<table class="table table-hover table-sm align-middle mb-0">
<thead><tr><th>Name</th><th>Status</th><th>vCPUs</th><th>RAM</th><th>Mandant</th></tr></thead>
<tbody>
{% for vm in vms %}
<tr>
<td><a href="{{ vm.get_absolute_url }}">{{ vm }}</a></td>
<td><span class="badge text-bg-{{ vm.get_status_color }}">{{ vm.get_status_display }}</span></td>
<td>{{ vm.vcpus|floatformat:"-1"|default:"—" }}</td>
<td>{% if vm.memory %}{{ vm.memory }} MB{% else %}—{% endif %}</td>
<td>{% if vm.tenant %}<a href="{{ vm.tenant.get_absolute_url }}">{{ vm.tenant }}</a>{% else %}—{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="card-body text-muted">Keine VMs mit diesem Gerät als Host.</div>
{% endif %}
{% if capacity.distributed 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 %}