mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 19:56: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:
parent
0977aef587
commit
ac8ff62e7e
20 changed files with 679 additions and 94 deletions
|
|
@ -61,6 +61,7 @@ from lxml import etree
|
|||
|
||||
from vrtManager import util
|
||||
from vrtManager.connection import NVRAM_DIR, wvmConnect
|
||||
from vrtManager.nodedevs import pci_address, usb_selector
|
||||
from vrtManager.storage import wvmStorage, wvmStorages
|
||||
|
||||
# Edits that redefine the domain start from this: the persistent definition,
|
||||
|
|
@ -68,6 +69,10 @@ from vrtManager.storage import wvmStorage, wvmStorages
|
|||
# password.
|
||||
PERSISTENT_XML = VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE
|
||||
|
||||
USB_HOSTDEVS = "devices/hostdev[@mode='subsystem'][@type='usb']"
|
||||
# what of the host a VM holds: host devices, and NICs that are host devices
|
||||
HOST_DEVICES = "devices/hostdev | devices/interface[@type='hostdev'] | devices/interface/actual[@type='hostdev']"
|
||||
|
||||
# External snapshot names become part of overlay and memory file names.
|
||||
SNAPSHOT_NAME = re.compile(r"[A-Za-z0-9_-][A-Za-z0-9._-]{0,63}")
|
||||
# the longest window wvmInstance.usage() averages over
|
||||
|
|
@ -141,6 +146,9 @@ class wvmInstances(wvmConnect):
|
|||
definitions = {dom.XMLDesc(0)}
|
||||
if state != 5:
|
||||
definitions.add(dom.XMLDesc(VIR_DOMAIN_XML_INACTIVE))
|
||||
# a host device is of the source host: the destination may have none, or another one
|
||||
if any(etree.fromstring(xml).xpath(HOST_DEVICES) for xml in definitions):
|
||||
raise util.OperationError("A VM with host devices cannot be migrated; remove them first")
|
||||
missing = self.missing_disks(definitions)
|
||||
if missing:
|
||||
raise util.OperationError(
|
||||
|
|
@ -1993,7 +2001,13 @@ class wvmInstance(wvmConnect):
|
|||
raise ValueError("Cannot clone a disk without a supported source and destination")
|
||||
disks.append((source, dev))
|
||||
|
||||
# a host device is one VM's: the clone gets none (the clone form says so)
|
||||
for hostdev in tree.findall("devices/hostdev"):
|
||||
hostdev.getparent().remove(hostdev)
|
||||
for num, net in enumerate(tree.findall("devices/interface")):
|
||||
if net.get("type") == "hostdev": # numbered as the form numbers the VM's NICs
|
||||
net.getparent().remove(net)
|
||||
continue
|
||||
mac = clone_data.get(f"clone-net-mac-{num}")
|
||||
if not mac:
|
||||
raise ValueError(f"No MAC address for network interface {num}")
|
||||
|
|
@ -2324,6 +2338,8 @@ class wvmInstance(wvmConnect):
|
|||
removed = None
|
||||
for xml_flags, affect in self._definitions():
|
||||
nic = self._nic(xml_flags, mac_address)
|
||||
if nic is not None and nic.get("type") == "hostdev":
|
||||
raise util.OperationError("A network interface that is a host device is removed in the XML editor")
|
||||
if nic is not None:
|
||||
removed = etree.tostring(nic).decode()
|
||||
self.instance.detachDeviceFlags(removed, affect)
|
||||
|
|
@ -2340,6 +2356,8 @@ class wvmInstance(wvmConnect):
|
|||
if not found:
|
||||
raise util.OperationError(f"No network interface with MAC {old_mac}")
|
||||
iface = found[0]
|
||||
if iface.get("type") == "hostdev":
|
||||
raise util.OperationError("A network interface that is a host device is changed in the XML editor")
|
||||
|
||||
iface_type = {"net": "network", "bridge": "bridge"}.get(source_type, "direct")
|
||||
iface.set("type", iface_type)
|
||||
|
|
@ -2362,6 +2380,79 @@ class wvmInstance(wvmConnect):
|
|||
|
||||
self._defineXML(etree.tostring(tree).decode())
|
||||
|
||||
def _usb_hostdevs(self, xml_flags):
|
||||
"""(element, selector) of each USB host device of a definition. The
|
||||
selector (usb_selector) is read from the migratable XML, the only one
|
||||
that marks the addresses libvirt resolved for a running VM."""
|
||||
elements = etree.fromstring(self._XMLDesc(xml_flags)).xpath(USB_HOSTDEVS)
|
||||
marked = etree.fromstring(self._XMLDesc(xml_flags | VIR_DOMAIN_XML_MIGRATABLE)).xpath(USB_HOSTDEVS)
|
||||
return [(element, usb_selector(mark.find("source"))) for element, mark in zip(elements, marked)]
|
||||
|
||||
def get_hostdevs(self):
|
||||
"""The VM's USB host devices, each once: its selector (vendor,
|
||||
product, address), whether the running VM has it and the device it
|
||||
holds there, whether its next start has it. And its other host
|
||||
devices (PCI, SCSI, mediated, NICs that are host devices), by type
|
||||
and PCI address, likewise: the panel does not change them."""
|
||||
usb = {}
|
||||
for xml_flags, affect in self._definitions():
|
||||
for element, selector in self._usb_hostdevs(xml_flags):
|
||||
row = usb.setdefault(selector, {"vendor": selector[0], "product": selector[1], "address": selector[2],
|
||||
"now": None, "next": False})
|
||||
if affect == VIR_DOMAIN_AFFECT_LIVE:
|
||||
held = element.find("source/address")
|
||||
row["now"] = (int(held.get("bus")), int(held.get("device"))) if held is not None else selector[2]
|
||||
else:
|
||||
row["next"] = True
|
||||
others = {}
|
||||
for xml_flags, affect in self._definitions():
|
||||
tree = etree.fromstring(self._XMLDesc(xml_flags))
|
||||
for device in tree.xpath("devices/hostdev[not(@type='usb')]"
|
||||
" | devices/interface[@type='hostdev' or actual/@type='hostdev']"):
|
||||
if device.tag == "interface" and device.get("type") != "hostdev":
|
||||
source = device.find("actual/source") # a NIC of a network that gives host devices
|
||||
else:
|
||||
source = device.find("source")
|
||||
address = source.find("address") if source is not None else None
|
||||
if address is not None and address.get("slot") is not None:
|
||||
label = pci_address(address.get("domain", "0"), address.get("bus"), address.get("slot"),
|
||||
address.get("function"))
|
||||
else: # a mediated device's UUID; a SCSI device as its source
|
||||
label = address.get("uuid", "") if address is not None else ""
|
||||
kind = "nic" if device.tag == "interface" else device.get("type", device.get("mode"))
|
||||
source_text = " ".join(etree.tostring(source, encoding="unicode").split()) if source is not None else ""
|
||||
row = others.setdefault((kind, label or source_text),
|
||||
{"type": kind, "address": label, "now": False, "next": False})
|
||||
row["now" if affect == VIR_DOMAIN_AFFECT_LIVE else "next"] = True
|
||||
return list(usb.values()), list(others.values())
|
||||
|
||||
def add_usb_hostdev(self, vendor, product, address=None):
|
||||
"""Gives the VM the host's USB device of vendor and product, at
|
||||
address (bus, device) when given: the host has more than one of the
|
||||
model. Refused without a USB controller."""
|
||||
for xml_flags, _ in self._definitions():
|
||||
if not etree.fromstring(self._XMLDesc(xml_flags)).xpath("devices/controller[@type='usb'][not(@model='none')]"):
|
||||
raise util.OperationError("The VM has no USB controller")
|
||||
hostdev = etree.Element("hostdev", mode="subsystem", type="usb", managed="yes")
|
||||
source = etree.SubElement(hostdev, "source")
|
||||
etree.SubElement(source, "vendor", id=vendor)
|
||||
etree.SubElement(source, "product", id=product)
|
||||
if address:
|
||||
etree.SubElement(source, "address", bus=str(address[0]), device=str(address[1]))
|
||||
self._attach_device(etree.tostring(hostdev, encoding="unicode"))
|
||||
|
||||
def delete_usb_hostdev(self, selector):
|
||||
"""Takes the USB host device of selector (usb_selector) from each
|
||||
definition that has it, as that definition describes it."""
|
||||
found = False
|
||||
for xml_flags, affect in self._definitions():
|
||||
for element, own in self._usb_hostdevs(xml_flags):
|
||||
if own == selector:
|
||||
found = True
|
||||
self.instance.detachDeviceFlags(etree.tostring(element, encoding="unicode"), affect)
|
||||
if not found:
|
||||
raise util.OperationError("The VM has no such USB device")
|
||||
|
||||
def set_link_state(self, mac_address, state):
|
||||
for xml_flags, affect in self._definitions():
|
||||
nic = self._nic(xml_flags, mac_address)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
from libvirt import VIR_ERR_NO_NODE_DEVICE, libvirtError
|
||||
from libvirt import VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV, VIR_ERR_NO_NODE_DEVICE, libvirtError
|
||||
from lxml import etree
|
||||
|
||||
from vrtManager.connection import wvmConnect
|
||||
from vrtManager import util
|
||||
|
||||
# PCI base classes by their code (the class's first byte)
|
||||
PCI_CLASSES = {
|
||||
|
|
@ -30,6 +30,8 @@ USB_CLASSES = {
|
|||
0xFF: _("Vendor specific"),
|
||||
}
|
||||
|
||||
USB_HUB = 0x09
|
||||
|
||||
|
||||
def pci_address(domain, bus, slot, function):
|
||||
"""A PCI address as lspci writes it, from its parts as integers or as
|
||||
|
|
@ -55,21 +57,27 @@ def host_resources(name, nodes, children):
|
|||
return found
|
||||
|
||||
|
||||
def usb_selector(source):
|
||||
"""(vendor, product, (bus, device) or None) of a USB <hostdev>'s <source>,
|
||||
the parts libvirt picks a device by. An address libvirt resolved for a
|
||||
running VM (autoAddress, in its migratable XML) is not one of them."""
|
||||
address = source.find("address")
|
||||
given = address is not None and source.get("autoAddress") != "yes"
|
||||
return (source.xpath("string(vendor/@id)").lower(), source.xpath("string(product/@id)").lower(),
|
||||
(int(address.get("bus")), int(address.get("device"))) if given else None)
|
||||
|
||||
|
||||
def hostdev_users(trees):
|
||||
"""What a VM's definitions give it of the host: PCI addresses (of a
|
||||
<hostdev>, or of a NIC that is a host device) and USB selectors
|
||||
(vendor, product, (bus, device) or None), as libvirt picks a USB device:
|
||||
by the parts given, all of them."""
|
||||
(usb_selector)."""
|
||||
pci, usb = set(), []
|
||||
for tree in trees:
|
||||
for address in tree.xpath("devices/hostdev[@mode='subsystem'][@type='pci']/source/address"
|
||||
" | devices/interface[@type='hostdev']/source/address"
|
||||
" | devices/interface/actual[@type='hostdev']/source/address"):
|
||||
pci.add(pci_address(address.get("domain", "0"), address.get("bus"), address.get("slot"), address.get("function")))
|
||||
for source in tree.xpath("devices/hostdev[@mode='subsystem'][@type='usb']/source"):
|
||||
address = source.find("address")
|
||||
usb.append((source.xpath("string(vendor/@id)").lower(), source.xpath("string(product/@id)").lower(),
|
||||
(int(address.get("bus")), int(address.get("device"))) if address is not None else None))
|
||||
usb.extend(usb_selector(source) for source in tree.xpath("devices/hostdev[@mode='subsystem'][@type='usb']/source"))
|
||||
return pci, usb
|
||||
|
||||
|
||||
|
|
@ -86,79 +94,136 @@ def usb_named(selector, model, address):
|
|||
return "model" if selected is None else None
|
||||
|
||||
|
||||
class wvmNodeDevices(wvmConnect):
|
||||
def get_node_devices(self):
|
||||
"""The host's PCI and USB devices, each with what the host has on it
|
||||
(host_resources) and the VMs whose definitions name it: one listing
|
||||
of every node device, one XML read each (a device gone meanwhile is
|
||||
left out), and the VMs' definitions read once (domain_trees)."""
|
||||
nodes = {}
|
||||
for device in self.wvm.listAllDevices(0):
|
||||
try:
|
||||
nodes[device.name()] = etree.fromstring(device.XMLDesc(0))
|
||||
except libvirtError as err:
|
||||
if err.get_error_code() != VIR_ERR_NO_NODE_DEVICE:
|
||||
raise
|
||||
children = {}
|
||||
for name, node in nodes.items():
|
||||
children.setdefault(node.findtext("parent"), []).append(name)
|
||||
def device_problems(label, vms, resources, vm):
|
||||
"""Why a host device cannot be given to the VM named vm: the other VMs
|
||||
that name it, and what the host has on it."""
|
||||
problems = []
|
||||
if others := sorted(set(vms) - {vm}):
|
||||
problems.append(f"{label} is given to {', '.join(others)}")
|
||||
if resources:
|
||||
problems.append(f"{label} holds the host's {', '.join(resources)}")
|
||||
return problems
|
||||
|
||||
vms = [(vm, *hostdev_users(trees)) for vm, trees in self.domain_trees()]
|
||||
pci = [self._pci(name, node, nodes, children, vms) for name, node in nodes.items()
|
||||
if node.find("capability").get("type") == "pci"]
|
||||
usb = [self._usb(name, node, nodes, children, vms) for name, node in nodes.items()
|
||||
if node.find("capability").get("type") == "usb_device"]
|
||||
# a model the host has more than one of: a VM that names it by model alone may take any of them
|
||||
models = [device["model"] for device in usb]
|
||||
for device in usb:
|
||||
device["same_model"] = models.count(device["model"]) > 1
|
||||
pci.sort(key=lambda device: (device["group"] is None, device["group"] or 0, device["address"]))
|
||||
usb.sort(key=lambda device: (device["bus"], device["device"]))
|
||||
return pci, usb
|
||||
|
||||
@staticmethod
|
||||
def _pci(name, node, nodes, children, vms):
|
||||
cap = node.find("capability")
|
||||
address = pci_address(cap.findtext("domain"), cap.findtext("bus"), cap.findtext("slot"), cap.findtext("function"))
|
||||
code = int(cap.findtext("class") or "0", 16)
|
||||
group = cap.xpath("string(iommuGroup/@number)")
|
||||
# SR-IOV: a virtual function's physical one
|
||||
physfn = cap.find("capability[@type='phys_function']/address")
|
||||
return {
|
||||
"address": address,
|
||||
"vendor": cap.findtext("vendor") or cap.xpath("string(vendor/@id)"),
|
||||
"product": cap.findtext("product") or cap.xpath("string(product/@id)"),
|
||||
"ids": f"{cap.xpath('string(vendor/@id)')[2:]}:{cap.xpath('string(product/@id)')[2:]}",
|
||||
"kind": PCI_CLASSES.get(code >> 16, _("Other")),
|
||||
"driver": node.findtext("driver/name") or "",
|
||||
"group": int(group) if group else None,
|
||||
"resources": host_resources(name, nodes, children),
|
||||
"vms": [vm for vm, pci, _ in vms if address in pci],
|
||||
"physfn": pci_address(physfn.get("domain"), physfn.get("bus"), physfn.get("slot"), physfn.get("function"))
|
||||
if physfn is not None else "",
|
||||
"vfs": len(cap.xpath("capability[@type='virt_functions']/address")),
|
||||
}
|
||||
def hostdev_problems(vm, pci, usb, wanted_pci, wanted_usb):
|
||||
"""Why the host's devices pci and usb (get_node_devices) that the VM
|
||||
named vm wants (hostdev_users) cannot be given to it: another VM names
|
||||
them too, the host has its own network interfaces, disks or graphics
|
||||
card on them, or they are USB hubs."""
|
||||
problems = []
|
||||
for device in pci:
|
||||
if device["address"] in wanted_pci:
|
||||
problems += device_problems(f"PCI device {device['address']}", device["vms"], device["resources"], vm)
|
||||
for device in usb:
|
||||
address = (device["bus"], device["device"])
|
||||
if any(usb_named(selector, device["model"], address) for selector in wanted_usb):
|
||||
label = f"USB device {device['bus']}/{device['device']} ({device['product']})"
|
||||
problems += device_problems(label, device["vms"] + device["by_model"], device["resources"], vm)
|
||||
if device["hub"]:
|
||||
problems.append(f"{label} is a hub")
|
||||
return problems
|
||||
|
||||
@staticmethod
|
||||
def _usb(name, node, nodes, children, vms):
|
||||
cap = node.find("capability")
|
||||
bus, device = int(cap.findtext("bus")), int(cap.findtext("device"))
|
||||
model = (cap.xpath("string(vendor/@id)").lower(), cap.xpath("string(product/@id)").lower())
|
||||
# a USB device's classes are its interfaces'
|
||||
codes = [int(nodes[child].findtext("capability/class") or "0") for child in children.get(name, [])
|
||||
if nodes[child].find("capability").get("type") == "usb"]
|
||||
named = [(vm, usb_named(selector, model, (bus, device))) for vm, _, selectors in vms for selector in selectors]
|
||||
by_address = sorted({vm for vm, how in named if how == "address"})
|
||||
return {
|
||||
"bus": bus,
|
||||
"device": device,
|
||||
"vendor": cap.findtext("vendor") or model[0],
|
||||
"product": cap.findtext("product") or model[1],
|
||||
"model": model,
|
||||
"ids": f"{model[0][2:]}:{model[1][2:]}",
|
||||
"kinds": sorted({str(USB_CLASSES.get(code, _("Other"))) for code in codes}),
|
||||
"resources": host_resources(name, nodes, children),
|
||||
"vms": by_address,
|
||||
# VMs that name its model only: which device of the model they take is known only when they start
|
||||
"by_model": sorted({vm for vm, how in named if how == "model"} - set(by_address)),
|
||||
}
|
||||
|
||||
def _pci(name, node, nodes, children, vms):
|
||||
cap = node.find("capability")
|
||||
address = pci_address(cap.findtext("domain"), cap.findtext("bus"), cap.findtext("slot"), cap.findtext("function"))
|
||||
code = int(cap.findtext("class") or "0", 16)
|
||||
group = cap.xpath("string(iommuGroup/@number)")
|
||||
# SR-IOV: a virtual function's physical one
|
||||
physfn = cap.find("capability[@type='phys_function']/address")
|
||||
return {
|
||||
"address": address,
|
||||
"vendor": cap.findtext("vendor") or cap.xpath("string(vendor/@id)"),
|
||||
"product": cap.findtext("product") or cap.xpath("string(product/@id)"),
|
||||
"ids": f"{cap.xpath('string(vendor/@id)')[2:]}:{cap.xpath('string(product/@id)')[2:]}",
|
||||
"kind": PCI_CLASSES.get(code >> 16, _("Other")),
|
||||
"driver": node.findtext("driver/name") or "",
|
||||
"group": int(group) if group else None,
|
||||
"resources": host_resources(name, nodes, children),
|
||||
"vms": [vm for vm, pci, _ in vms if address in pci],
|
||||
"physfn": pci_address(physfn.get("domain"), physfn.get("bus"), physfn.get("slot"), physfn.get("function"))
|
||||
if physfn is not None else "",
|
||||
"vfs": len(cap.xpath("capability[@type='virt_functions']/address")),
|
||||
}
|
||||
|
||||
|
||||
|
||||
def _usb(name, node, nodes, children, vms):
|
||||
cap = node.find("capability")
|
||||
bus, device = int(cap.findtext("bus")), int(cap.findtext("device"))
|
||||
model = (cap.xpath("string(vendor/@id)").lower(), cap.xpath("string(product/@id)").lower())
|
||||
# a USB device's classes are its interfaces'
|
||||
codes = [int(nodes[child].findtext("capability/class") or "0") for child in children.get(name, [])
|
||||
if nodes[child].find("capability").get("type") == "usb"]
|
||||
named = [(vm, usb_named(selector, model, (bus, device))) for vm, _, selectors in vms for selector in selectors]
|
||||
by_address = sorted({vm for vm, how in named if how == "address"})
|
||||
return {
|
||||
"bus": bus,
|
||||
"device": device,
|
||||
"vendor": cap.findtext("vendor") or model[0],
|
||||
"product": cap.findtext("product") or model[1],
|
||||
"model": model,
|
||||
"ids": f"{model[0][2:]}:{model[1][2:]}",
|
||||
"kinds": sorted({str(USB_CLASSES.get(code, _("Other"))) for code in codes}),
|
||||
"hub": USB_HUB in codes,
|
||||
"resources": host_resources(name, nodes, children),
|
||||
"vms": by_address,
|
||||
# VMs that name its model only: which device of the model they take is known only when they start
|
||||
"by_model": sorted({vm for vm, how in named if how == "model"} - set(by_address)),
|
||||
}
|
||||
|
||||
|
||||
def node_devices(conn):
|
||||
"""The PCI and USB devices of the host of conn (a wvmConnect), each with what the host has on it
|
||||
(host_resources) and the VMs whose definitions name it: one listing
|
||||
of every node device, one XML read each (a device gone meanwhile is
|
||||
left out), and the VMs' definitions read once (domain_trees)."""
|
||||
nodes = {}
|
||||
for device in conn.wvm.listAllDevices(0):
|
||||
try:
|
||||
nodes[device.name()] = etree.fromstring(device.XMLDesc(0))
|
||||
except libvirtError as err:
|
||||
if err.get_error_code() != VIR_ERR_NO_NODE_DEVICE:
|
||||
raise
|
||||
children = {}
|
||||
for name, node in nodes.items():
|
||||
children.setdefault(node.findtext("parent"), []).append(name)
|
||||
|
||||
vms = [(vm, *hostdev_users(trees)) for vm, trees in conn.domain_trees()]
|
||||
pci = [_pci(name, node, nodes, children, vms) for name, node in nodes.items()
|
||||
if node.find("capability").get("type") == "pci"]
|
||||
usb = [_usb(name, node, nodes, children, vms) for name, node in nodes.items()
|
||||
if node.find("capability").get("type") == "usb_device"]
|
||||
# a model the host has more than one of: a VM that names it by model alone may take any of them
|
||||
models = [device["model"] for device in usb]
|
||||
for device in usb:
|
||||
device["same_model"] = models.count(device["model"]) > 1
|
||||
pci.sort(key=lambda device: (device["group"] is None, device["group"] or 0, device["address"]))
|
||||
usb.sort(key=lambda device: (device["bus"], device["device"]))
|
||||
return pci, usb
|
||||
|
||||
|
||||
def usb_names(conn):
|
||||
"""The product names of the host's USB devices, by their (vendor, product)
|
||||
IDs: one listing of the USB devices, one XML read each; none when they
|
||||
cannot be read, as the names are only shown."""
|
||||
names = {}
|
||||
try:
|
||||
for device in conn.wvm.listAllDevices(VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV):
|
||||
cap = etree.fromstring(device.XMLDesc(0)).find("capability")
|
||||
model = (cap.xpath("string(vendor/@id)").lower(), cap.xpath("string(product/@id)").lower())
|
||||
names[model] = cap.findtext("product") or ""
|
||||
except libvirtError: # a device gone meanwhile, or the host: the IDs are shown
|
||||
return {}
|
||||
return names
|
||||
|
||||
|
||||
def check_hostdevs(conn, vm, trees):
|
||||
"""Refuses the host devices the definitions trees give the VM named vm,
|
||||
on the host of conn, when they cannot be (hostdev_problems)."""
|
||||
wanted = hostdev_users(trees)
|
||||
if not any(wanted):
|
||||
return
|
||||
pci, usb = node_devices(conn)
|
||||
if problems := hostdev_problems(vm, pci, usb, *wanted):
|
||||
raise util.OperationError("; ".join(problems))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue