mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
guest: Query availability of usb redirdevs in domcaps
Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
parent
cbc5b89707
commit
8cc6ee8da3
@ -113,6 +113,7 @@ class _Devices(_CapsBlock):
|
||||
graphics = XMLChildProperty(_make_capsblock("graphics"), is_single=True)
|
||||
tpm = XMLChildProperty(_make_capsblock("tpm"), is_single=True)
|
||||
filesystem = XMLChildProperty(_make_capsblock("filesystem"), is_single=True)
|
||||
redirdev = XMLChildProperty(_make_capsblock("redirdev"), is_single=True)
|
||||
|
||||
|
||||
class _Features(_CapsBlock):
|
||||
@ -448,6 +449,18 @@ class DomainCapabilities(XMLBuilder):
|
||||
|
||||
return self.devices.graphics.get_enum("type").has_value("spice")
|
||||
|
||||
def supports_redirdev_usb(self):
|
||||
"""
|
||||
Return False if libvirt explicitly advertises no support for
|
||||
USB redirect
|
||||
"""
|
||||
if self.devices.redirdev.supported is None:
|
||||
# Follow the original behavior in case of talking to older
|
||||
# libvirt.
|
||||
return True
|
||||
|
||||
return self.devices.redirdev.get_enum("bus").has_value("usb")
|
||||
|
||||
def supports_filesystem_virtiofs(self):
|
||||
"""
|
||||
Return True if libvirt advertises support for virtiofs
|
||||
|
@ -1155,6 +1155,8 @@ class Guest(XMLBuilder):
|
||||
self.add_device(dev)
|
||||
|
||||
def _add_spice_usbredir(self):
|
||||
if not self.lookup_domcaps().supports_redirdev_usb():
|
||||
return
|
||||
if self.skip_default_usbredir:
|
||||
return
|
||||
if self.devices.redirdev:
|
||||
|
Loading…
Reference in New Issue
Block a user