virt-install: let libvirt handle --input bus=default

Our logic here is poorly duplicating libvirt's postparse logic.
Notably it will try to add bus=ps2 on non-x86, and misses obscure
cases like parallels.

https://issues.redhat.com/browse/RHEL-66768

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-11-14 11:20:17 -05:00 committed by Pavel Hrdina
parent fa927c7836
commit c78ec96933
4 changed files with 5 additions and 19 deletions

View File

@ -723,8 +723,8 @@
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<input type="keyboard" bus="usb"/>
<input type="tablet" bus="usb"/>
<input type="mouse" bus="ps2"/>
<input type="tablet"/>
<input type="mouse"/>
<input type="mouse" bus="virtio" model="virtio-non-transitional"/>
<input type="passthrough" bus="virtio">
<source evdev="/dev/input/event1"/>

View File

@ -51,7 +51,7 @@
<model type="virtio"/>
</interface>
<console type="pty"/>
<input type="tablet" bus="usb"/>
<input type="tablet"/>
<tpm model="tpm-crb">
<backend type="emulator"/>
</tpm>

View File

@ -26,7 +26,7 @@
<mac address="00:11:22:33:44:55"/>
</interface>
<console type="pty"/>
<input type="mouse" bus="xen"/>
<input type="mouse"/>
<graphics type="vnc" port="-1"/>
</devices>
<on_reboot>destroy</on_reboot>
@ -58,7 +58,7 @@
<mac address="00:11:22:33:44:55"/>
</interface>
<console type="pty"/>
<input type="mouse" bus="xen"/>
<input type="mouse"/>
<graphics type="vnc" port="-1"/>
</devices>
</domain>

View File

@ -37,20 +37,6 @@ class DeviceInput(Device):
# Default config #
##################
def _default_bus(self, _guest):
if self.type == self.TYPE_TABLET:
return self.BUS_USB
# This is not explicitly stated in the docs, but the example provided
# for evdev inputs does not have a bus type set and libvirt won't
# accept such XML either.
if self.type == self.TYPE_EVDEV:
return None
if self.conn.is_xen():
return self.BUS_XEN
return self.BUS_PS2
def set_defaults(self, guest):
if not self.type:
self.type = self.TYPE_MOUSE
if not self.bus:
self.bus = self._default_bus(guest)