domain: Remove pre-startup USB collision check

Libvirt nowadays will throw an explicit warning about this
exact situation. It doesn't guide people to virt-manager UI, but
then again it should be obscure enough that it doesn't warrant this
special corner case code to inform the user
This commit is contained in:
Cole Robinson 2019-06-05 18:50:28 -04:00
parent b9981b4623
commit aabde5bbe6
1 changed files with 0 additions and 41 deletions

View File

@ -177,7 +177,6 @@ class vmmDomain(vmmLibvirtObject):
__gsignals__ = {
"resources-sampled": (vmmLibvirtObject.RUN_FIRST, None, []),
"inspection-changed": (vmmLibvirtObject.RUN_FIRST, None, []),
"pre-startup": (vmmLibvirtObject.RUN_FIRST, None, [object]),
}
def __init__(self, conn, backend, key):
@ -228,39 +227,6 @@ class vmmDomain(vmmLibvirtObject):
# is blacklisted.
raise RuntimeError("Can't track Domain-0 as a vmmDomain")
self.connect("pre-startup", self._prestartup_nodedev_check)
def _prestartup_nodedev_check(self, src, ret):
ignore = src
error = _("There is more than one '%s' device attached to "
"your host, and we can't determine which one to "
"use for your guest.\n"
"To fix this, remove and reattach the USB device "
"to your guest using the 'Add Hardware' wizard.")
usb_nodedevs = self.conn.filter_nodedevs("usb_device")
for hostdev in self.xmlobj.devices.hostdev:
devtype = hostdev.type
if devtype != "usb":
continue
vendor = hostdev.vendor
product = hostdev.product
bus = hostdev.bus
device = hostdev.device
if not vendor or not product:
continue
count = len([d for d in usb_nodedevs if
(d.xmlobj.vendor_id == vendor and
d.xmlobj.product_id == product)])
if count > 1 and not (bus and device):
prettyname = "%s %s" % (vendor, product)
ret.append(error % prettyname)
###########################
# Misc API getter methods #
@ -1317,13 +1283,6 @@ class vmmDomain(vmmLibvirtObject):
if self.get_cloning():
raise RuntimeError(_("Cannot start guest while cloning "
"operation in progress"))
pre_startup_ret = []
self.emit("pre-startup", pre_startup_ret)
for error in pre_startup_ret:
raise RuntimeError(error)
self._backend.create()
@vmmLibvirtObject.lifecycle_action