mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
Plan reviewed with Codex; tried on a udev host (AlmaLinux 10) and a netcf one (AlmaLinux 8). - Changes are one change of the host's configuration (libvirt's interface change transaction): a bridge that does not start used to be undefined, leaving its member without the addresses and start mode the bridge took from it; now the whole change rolls back, the member's own configuration too, and so does a commit libvirt refuses. A rollback that fails too is reported with the failure, saying the host's configuration may be changed. Deleting a bridge, which defines its members again on their own, is one change as well. - A running interface is not deleted: the page hid Delete, but a post deleted it. A bridge with addresses and several members is refused (which member takes the addresses is the user's choice); the confirmation says that its members are defined again. - A bridge takes only a device in no bridge, bond or VLAN as the host has them configured, at any depth (a bridge's bond's devices), not the loopback, a libvirt network's bridge or a VM's tap; an ethernet interface configures only such a device too. - Whether the host can change interfaces: unsupported or refused by its access rules is a no, bad XML a yes, anything else (the connection, the login) is raised instead of taken for a yes. A page whose host could not be read offers no actions. - Reads: the list reads each interface's XML once from one listing (listAllInterfaces: every state, not the active and the defined ones apart); a page reads the running and the saved definition once each (cached_property). netcf writes a link speed of -1 for a card that has none (a virtio one) and then refuses its own XML: the saved one is read instead, where virsh and the page failed. Name and MAC come from libvirt's object, without a call. Each family says how it is addressed (DHCP, autoconf, static or none) and every address, its prefix where it has one; no address is not "DHCP" any more. A bridge's members carry their link state and speed; an unknown speed (0, -1, 4294967295) is none. - The interface API lists from the same reader. get_details, get_bridge, get_bridge_slave_ifaces and the per-family getters go.
83 lines
No EOL
4.3 KiB
HTML
83 lines
No EOL
4.3 KiB
HTML
{% extends "base.html" %}
|
||
{% load i18n %}
|
||
{% load bootstrap_icons %}
|
||
|
||
{% block title %}{% trans "Interface" %} - {{ iface }}{% endblock %}
|
||
|
||
{% block page_heading %}{% trans "Interface" %}: {{ iface }}{% endblock page_heading %}
|
||
|
||
{% block content %}
|
||
<div class="row">
|
||
<div class="col-lg-12">
|
||
{% include "computes/host_nav.html" with section="interfaces" detail=True %}
|
||
</div>
|
||
</div>
|
||
|
||
{% if changeable is False %}{% include 'interfaces_unchangeable.html' %}{% endif %}
|
||
<div class="row">
|
||
<div class="col-12">
|
||
{% if info %}
|
||
<dl class="ms-3 row">
|
||
<dt class="col-4">{% trans "Interface" %}</dt>
|
||
<dd class="col-8"><strong>{{ iface }}</strong></dd>
|
||
<dt class="col-4">{% trans "IPv4" %}{% if info.ipv4.method %} ({{ info.ipv4.method }}){% endif %}</dt>
|
||
<dd class="col-8">{{ info.ipv4.addresses|join:", "|default:"–" }}</dd>
|
||
<dt class="col-4">{% trans "IPv6" %}{% if info.ipv6.method %} ({{ info.ipv6.method }}){% endif %}</dt>
|
||
<dd class="col-8">{{ info.ipv6.addresses|join:", "|default:"–" }}</dd>
|
||
<dt class="col-4">{% trans "MAC" %}</dt>
|
||
<dd class="col-8">{{ info.mac|default:"–" }}</dd>
|
||
<dt class="col-4">{% trans "Interface Type" %}</dt>
|
||
<dd class="col-8">{{ info.type }}</dd>
|
||
<dt class="col-4">{% trans "Boot Mode" %}</dt>
|
||
<dd class="col-8">{{ info.start_mode|default:"–" }}</dd>
|
||
<dt class="col-4">{% trans "State" %}</dt>
|
||
<dd class="col-8">
|
||
{% if changeable %}
|
||
<form action="" method="post" role="form" aria-label="Interface start/stop/delete form">{% csrf_token %}
|
||
{% if state == 0 %}
|
||
<input type="submit" class="btn btn-sm btn-primary" name="start" value="{% trans "Start" %}">
|
||
<input type="submit" class="btn btn-sm btn-danger" name="delete" value="{% trans "Delete" %}" data-confirm="{% blocktrans with name=iface %}Delete interface {{ name }}? Its definition is removed from the host; a bridge's members are defined again on their own, its addresses going to its only member.{% endblocktrans %}" onclick="return confirm(this.dataset.confirm)">
|
||
{% else %}
|
||
<input type="submit" class="btn btn-sm btn-secondary" name="stop" value="{% trans "Stop" %}" data-confirm="{% blocktrans with name=iface %}Stop interface {{ name }}? The host and its VMs lose their connections through it at once; if you reach the host through it, you lose the host.{% endblocktrans %}" onclick="return confirm(this.dataset.confirm)">
|
||
{% endif %}
|
||
</form>
|
||
{% else %}
|
||
{% if state == 0 %}{% trans "Inactive" %}{% else %}{% trans "Active" %}{% endif %}
|
||
{% endif %}
|
||
</dd>
|
||
</dl>
|
||
{% endif %}
|
||
</div>
|
||
|
||
{% if info.members %}
|
||
<div class="col-sm-12">
|
||
<h5>{% trans 'Members' %}</h5>
|
||
<div class="table-responsive">
|
||
<table class="table table-bordered align-middle">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">{% trans 'MAC' %}</th>
|
||
<th scope="col">{% trans 'Name' %}</th>
|
||
<th scope="col">{% trans 'Type' %}</th>
|
||
<th scope="col">{% trans 'Speed' %}</th>
|
||
<th scope="col">{% trans 'State' %}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for member in info.members %}
|
||
<tr>
|
||
<td>{{ member.mac|default:"–" }}</td>
|
||
<td>{{ member.name }}</td>
|
||
<td>{{ member.type }}</td>
|
||
<td>{{ member.speed|default:"–" }}</td>
|
||
<td>{{ member.link|default:"–" }}</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
|
||
{% endblock %} |