mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): USB device changes as PCI ones; device refusals name no VM to owners
- 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.
This commit is contained in:
parent
d07362106a
commit
2db25314ea
12 changed files with 662 additions and 563 deletions
|
|
@ -2134,10 +2134,10 @@ def host_devices(request, pk):
|
|||
state = domain.info()[0]
|
||||
# the VM's next start takes its USB devices as its definition names them
|
||||
unmatched = usb_unmatched([etree.fromstring(domain.XMLDesc(VIR_DOMAIN_XML_INACTIVE))], usb)
|
||||
saved = domain.hasManagedSaveImage(0) # the VM would start from it without the change
|
||||
context = {"instance": instance, "host_pci": pci, "host_usb": usb, "running": state == VIR_DOMAIN_RUNNING,
|
||||
"unmatched": [util.render(m["text"], m["values"], _) for m in unmatched],
|
||||
# paused, or with a saved state the VM would start from without the change
|
||||
"pci_frozen": state not in (VIR_DOMAIN_RUNNING, VIR_DOMAIN_SHUTOFF) or domain.hasManagedSaveImage(0)}
|
||||
"unmatched": [util.render(m["text"], m["values"], _) for m in unmatched], "usb_frozen": saved,
|
||||
"pci_frozen": state not in (VIR_DOMAIN_RUNNING, VIR_DOMAIN_SHUTOFF) or saved}
|
||||
except libvirtError as err:
|
||||
context = {"instance": instance, "error": err}
|
||||
return render(request, "instances/host_devices_form.html", context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue