osdict: Fix incorrect usage of virtio input
Regression reported with latest libosinfo, when the OS reports virtio-input support: http://www.redhat.com/archives/virt-tools-list/2016-July/msg00109.html Really our code presently only cares about the USB tablet, so adjust our libosinfo lookup to explicitly check for it
This commit is contained in:
parent
9cdf78e94c
commit
1d2cd30677
|
@ -1031,15 +1031,14 @@ class Guest(XMLBuilder):
|
|||
return False
|
||||
return all([c.model == "none" for c in controllers])
|
||||
|
||||
input_type = self._os_object.default_inputtype()
|
||||
input_bus = self._os_object.default_inputbus()
|
||||
input_type = "mouse"
|
||||
input_bus = "ps2"
|
||||
if self.os.is_xenpv():
|
||||
input_type = VirtualInputDevice.TYPE_MOUSE
|
||||
input_bus = VirtualInputDevice.BUS_XEN
|
||||
elif _usb_disabled() and input_bus == "usb":
|
||||
input_bus = "ps2"
|
||||
if input_type == "tablet":
|
||||
input_type = "mouse"
|
||||
elif self._os_object.supports_usbtablet() and not _usb_disabled():
|
||||
input_type = "tablet"
|
||||
input_bus = "usb"
|
||||
|
||||
for inp in self.get_devices("input"):
|
||||
if (inp.type == inp.TYPE_DEFAULT and
|
||||
|
|
|
@ -457,23 +457,19 @@ class _OsVariant(object):
|
|||
return devname
|
||||
return None
|
||||
|
||||
def default_inputtype(self):
|
||||
if self._os:
|
||||
fltr = libosinfo.Filter()
|
||||
fltr.add_constraint("class", "input")
|
||||
devs = self._os.get_all_devices(fltr)
|
||||
if devs.get_length():
|
||||
return devs.get_nth(0).get_name()
|
||||
return "mouse"
|
||||
def supports_usbtablet(self):
|
||||
if not self._os:
|
||||
return False
|
||||
|
||||
def default_inputbus(self):
|
||||
if self._os:
|
||||
fltr = libosinfo.Filter()
|
||||
fltr.add_constraint("class", "input")
|
||||
devs = self._os.get_all_devices(fltr)
|
||||
if devs.get_length():
|
||||
return devs.get_nth(0).get_bus_type()
|
||||
return "ps2"
|
||||
fltr = libosinfo.Filter()
|
||||
fltr.add_constraint("class", "input")
|
||||
fltr.add_constraint("name", "tablet")
|
||||
devs = self._os.get_all_devices(fltr)
|
||||
for idx in range(devs.get_length()):
|
||||
dev = devs.get_nth(idx)
|
||||
if devs.get_nth(idx).get_bus_type() == "usb":
|
||||
return True
|
||||
return False
|
||||
|
||||
def supports_virtiodisk(self):
|
||||
if self._os:
|
||||
|
|
Loading…
Reference in New Issue