Commit 287e5156 authored by Guido Günther's avatar Guido Günther

osdict: Fix incorrect usage of virtio input

Thanks: Laurent Bigonville for the concise report
Closes: #846356
parent 6e15ef5f
From: Cole Robinson <crobinso@redhat.com>
Date: Fri, 29 Jul 2016 13:17:36 -0400
Subject: 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
---
virtinst/guest.py | 11 +++++------
virtinst/osdict.py | 28 ++++++++++++----------------
2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 957e818..e24e233 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -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
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 38d626d..8b0ef7b 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -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:
......@@ -4,3 +4,4 @@ Mark-Jessie-as-having-qemu-guest-agent.patch
osdict-Don-t-return-virtio1.0-net-as-a-valid-device-name.patch
We-can-t-clone-a-VM-in-some-scenarios.patch
Use-usr-bin-python.patch
osdict-Fix-incorrect-usage-of-virtio-input.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment