1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

feat(instances): USB devices of the host given to a VM

- A Host devices tab on the VM page lists the VM's USB host devices, each
  once: how it is chosen (its address, or any device of its model), the
  device the running VM holds and whether its next start has it; its other
  host devices (PCI, SCSI, mediated) are listed for the XML editor.
- Superusers add a USB device of the host and take it back, on a running
  VM too. The add form is loaded when the tab opens, as its choices read
  every VM of the host; a hub, a device the host has its own disks or
  network interfaces on, or one another VM names is not offered, with the
  reason, and refused on the server under the compute's claim. A device is
  chosen by model when the host has one of it, else by its address.
- A VM without a USB controller is refused; a device is taken from each
  definition as that definition describes it.
- A clone gets none of the VM's host devices (the clone form says so), and
  a VM with host devices is not migrated. A snapshot revert is refused when
  it would give the VM a device another VM names or the host uses.
- A NIC that is a host device is no longer edited or removed from the
  Network tab: the XML editor changes it.
This commit is contained in:
catborise 2026-10-29 13:16:45 +03:00
parent 0977aef587
commit ac8ff62e7e
20 changed files with 679 additions and 94 deletions

View file

@ -428,6 +428,22 @@
});
</script>
<script>
// the Host devices tab's add form: loaded once, when the tab first opens
var hostUsb = document.getElementById("host-usb");
if (hostUsb) {
document.querySelector('[data-bs-target="#hostdevs"]').addEventListener("shown.bs.tab", function () {
if (hostUsb.dataset.loaded) return;
hostUsb.dataset.loaded = "true";
fetch(hostUsb.dataset.url).then(function (response) {
if (!response.ok) throw new Error(response.statusText);
return response.text();
}).then(function (html) {
hostUsb.innerHTML = html;
}).catch(function () {
hostUsb.textContent = "{{ _("The host's USB devices could not be read.")|escapejs }}";
});
});
}
function get_osinfo() {
show_tab('#settings');
show_tab('#osinfo');