You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.9 KiB
83 lines
2.9 KiB
From: Cole Robinson <crobinso@redhat.com> |
|
Date: Fri, 29 Jul 2016 13:17:36 -0400 |
|
Subject: [PATCH virt-manager] 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 |
|
|
|
(cherry picked from commit 1d2cd306773064258f5d02c980b09a683ae77798) |
|
--- |
|
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 6a42536..9df4a1c 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 e8c1487..bfc435b 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:
|
|
|