mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
- A USB device added to or removed from a VM with a saved state applied only at the next cold boot: refused now, as for PCI devices, and the form says so. - A USB hot plug or removal that failed half way said only libvirt's error: it now says where the device is, as for PCI devices (_hostdev_outcome, shared). - A host device refusal (check_hostdevs) names the other VMs that have the device; users who do not see the hosts, such as an owner whose snapshot revert is refused, now read that a device is not free and that an administrator can see why. - The host's USB devices named among a PCI device's host resources were English in every language.
34 lines
3.2 KiB
HTML
34 lines
3.2 KiB
HTML
{% load i18n %}
|
|
{% load bootstrap_icons %}
|
|
{# the add forms of the Host devices tab: each choice disabled with the reasons it cannot be given #}
|
|
{% if error %}
|
|
<div class="alert alert-warning mb-0">{% blocktrans %}The host's devices could not be read: {{ error }}{% endblocktrans %}</div>
|
|
{% else %}
|
|
{% if unmatched %}
|
|
<div class="alert alert-warning">{% blocktrans with problems=unmatched|join:"; " %}The VM does not start until this is fixed: {{ problems }}. Remove the device and add the one the host has.{% endblocktrans %}</div>
|
|
{% endif %}
|
|
<form method="post" action="{% url 'instances:add_usb_hostdev' instance.id %}" class="d-flex flex-wrap gap-2 mb-2">{% csrf_token %}
|
|
<select name="usb_device" class="form-select w-auto mw-100" aria-label="{% trans "USB device of the host" %}"{% if usb_frozen %} aria-describedby="usb_help"{% endif %} required{% if usb_frozen %} disabled{% endif %}>
|
|
<option value="" selected disabled>{% trans "Choose a USB device of the host…" %}</option>
|
|
{% for device in host_usb %}
|
|
<option value="{{ device.bus }}/{{ device.device }}/{{ device.ids }}"{% if device.problems %} disabled{% endif %}>{{ device.product }} ({{ device.ids }}, {{ device.bus }}/{{ device.device }}){% if device.problems %}: {{ device.problems|join:"; " }}{% endif %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button type="submit" class="btn btn-primary"{% if usb_frozen %} disabled{% endif %}>{% bs_icon 'plus-lg' %} {% trans "Add USB device" %}</button>
|
|
{% if usb_frozen %}<div class="form-text w-100" id="usb_help">{% trans "A VM with a saved state does not change its USB devices: start it, or start it without its saved state" %}</div>{% endif %}
|
|
</form>
|
|
<form method="post" action="{% url 'instances:add_pci_hostdev' instance.id %}" class="d-flex flex-wrap gap-2">{% csrf_token %}
|
|
<select name="pci_device" class="form-select w-auto mw-100" aria-label="{% trans "PCI device of the host" %}" aria-describedby="pci_help" required{% if pci_frozen %} disabled{% endif %}>
|
|
<option value="" selected disabled>{% trans "Choose a PCI device of the host…" %}</option>
|
|
{% for device in host_pci %}
|
|
<option value="{{ device.address }}"{% if device.problems %} disabled{% endif %}>{{ device.product }} ({{ device.address }}, {{ device.driver|default:_("no driver") }}){% if device.problems %}: {{ device.problems|join:"; " }}{% endif %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button type="submit" class="btn btn-primary"{% if pci_frozen %} disabled{% endif %}>{% bs_icon 'plus-lg' %} {% trans "Add PCI device" %}</button>
|
|
<div class="form-text w-100" id="pci_help">
|
|
{% if pci_frozen %}{% trans "A paused VM, or one with a saved state, does not change its PCI devices." %}
|
|
{% elif running %}{% trans "The device is plugged into the running VM at once and kept for its next start; libvirt binds it to vfio-pci. It needs a free slot: on a q35 VM a free pcie-root-port, added while the VM is shut off." %}
|
|
{% else %}{% trans "libvirt binds the device to vfio-pci when the VM starts, and gives it back to the host when the VM stops; a device bound to vfio-pci before stays bound to it." %}{% endif %}
|
|
</div>
|
|
</form>
|
|
{% endif %}
|