diff --git a/man/virt-install.pod b/man/virt-install.pod index 2fbe4885..66f762de 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -998,6 +998,14 @@ proper device (if needed). This applies to all PCI devices. Use --controller=? to see a list of all available sub options. Complete details at L + +=item B<--input> OPTIONS + +Attach an input device to the guest. Example input device types are mouse, tablet, or keyboard. + +Use --input=? to see a list of all available sub options. Complete details at L + + =item B<--hostdev> OPTIONS =item B<--host-device> OPTIONS diff --git a/man/virt-xml.pod b/man/virt-xml.pod index 3b08eff8..d3831771 100644 --- a/man/virt-xml.pod +++ b/man/virt-xml.pod @@ -192,6 +192,8 @@ Before defining or updating the domain, show the generated XML diff and interact =item B<--controller> +=item B<--input> + =item B<--serial> =item B<--parallel> diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml index b80feb98..82f51358 100644 --- a/tests/cli-test-xml/compare/virt-install-many-devices.xml +++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml @@ -174,7 +174,8 @@ - + + diff --git a/tests/clitest.py b/tests/clitest.py index 7e23ca07..013b23fe 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -555,6 +555,9 @@ c.add_compare(""" \ --controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 \ --controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 \ \ +--input keyboard,bus=usb \ +--input type=tablet \ +\ --serial tcp,host=:2222,mode=bind,protocol=telnet \ --parallel udp,host=0.0.0.0:1234,bind_host=127.0.0.1:1234 \ --parallel unix,path=/tmp/foo-socket \ diff --git a/virtinst/cli.py b/virtinst/cli.py index 694ce7b9..e754a26d 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -42,6 +42,7 @@ from .devicedisk import VirtualDisk from .devicefilesystem import VirtualFilesystem from .devicegraphics import VirtualGraphics from .devicehostdev import VirtualHostDevice +from .deviceinput import VirtualInputDevice from .deviceinterface import VirtualNetworkInterface from .devicememballoon import VirtualMemballoon from .devicepanic import VirtualPanicDevice @@ -574,6 +575,10 @@ def add_device_options(devg, sound_back_compat=False): devg.add_argument("--controller", action="append", help=_("Configure a guest controller device. Ex:\n" "--controller type=usb,model=ich9-ehci1")) + devg.add_argument("--input", action="append", + help=_("Configure a guest input device. Ex:\n" + "--input tablet\n" + "--input keyboard,bus=usb")) devg.add_argument("--serial", action="append", help=_("Configure a guest serial device")) devg.add_argument("--parallel", action="append", @@ -1782,6 +1787,19 @@ class ParserController(VirtCLIParser): return VirtCLIParser._parse(self, opts, inst) +################### +# --input parsing # +################### + +class ParserInput(VirtCLIParser): + def _init_params(self): + self.devclass = VirtualInputDevice + self.remove_first = "type" + + self.set_param("type", "type") + self.set_param("bus", "bus") + + ####################### # --smartcard parsing # ####################### @@ -2182,6 +2200,7 @@ def build_parser_map(options, skip=None, only=None): register_parser("network", ParserNetwork) register_parser("graphics", ParserGraphics) register_parser("controller", ParserController) + register_parser("input", ParserInput) register_parser("smartcard", ParserSmartcard) register_parser("redirdev", ParserRedir) register_parser("tpm", ParserTPM) diff --git a/virtinst/deviceinput.py b/virtinst/deviceinput.py index 2fe078ae..4cc75107 100644 --- a/virtinst/deviceinput.py +++ b/virtinst/deviceinput.py @@ -26,8 +26,9 @@ class VirtualInputDevice(VirtualDevice): TYPE_MOUSE = "mouse" TYPE_TABLET = "tablet" + TYPE_KEYBOARD = "keyboard" TYPE_DEFAULT = "default" - TYPES = [TYPE_MOUSE, TYPE_TABLET, TYPE_DEFAULT] + TYPES = [TYPE_MOUSE, TYPE_TABLET, TYPE_KEYBOARD, TYPE_DEFAULT] BUS_PS2 = "ps2" BUS_USB = "usb"