diff --git a/virt-install b/virt-install index 9d4db008..7acf9960 100755 --- a/virt-install +++ b/virt-install @@ -529,17 +529,10 @@ def build_guest_instance(conn, options): cli.get_tpms(guest, options.tpm) cli.get_rngs(guest, options.rng) - if not guest.get_devices("input"): - guest.add_default_input_device() - if not guest.get_devices("console") and not guest.get_devices("serial"): - guest.add_default_console_device() - if not guest.get_devices("video") and guest.get_devices("graphics"): - guest.add_default_video_device() - - do_default_usb = all([d.type != "usb" for d in - guest.get_devices("controller")]) - if do_default_usb: - guest.add_default_usb_controller() + guest.add_default_input_device() + guest.add_default_console_device() + guest.add_default_video_device() + guest.add_default_usb_controller() # Install options cli.set_os_variant(guest, options.distro_type, options.distro_variant) diff --git a/virtManager/create.py b/virtManager/create.py index fc20d090..70f2d86f 100644 --- a/virtManager/create.py +++ b/virtManager/create.py @@ -1488,8 +1488,8 @@ class vmmCreate(vmmGObjectUI): gdev = self.get_graphics_device(guest) if gdev: guest.add_device(gdev) - guest.add_default_video_device() + guest.add_default_video_device() guest.add_default_input_device() guest.add_default_console_device() if self.config.get_new_vm_sound(): diff --git a/virtinst/guest.py b/virtinst/guest.py index a2dfbd03..402d6591 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -507,6 +507,8 @@ class Guest(XMLBuilder): return if not self.os.is_x86(): return + if self.get_devices("input"): + return self.add_device(virtinst.VirtualInputDevice(self.conn)) def add_default_sound_device(self): @@ -519,6 +521,9 @@ class Guest(XMLBuilder): def add_default_console_device(self): if self.os.is_xenpv(): return + if self.get_devices("console") or self.get_devices("serial"): + return + dev = virtinst.VirtualConsoleDevice(self.conn) dev.type = dev.TYPE_PTY self.add_device(dev) @@ -526,6 +531,10 @@ class Guest(XMLBuilder): def add_default_video_device(self): if self.os.is_container(): return + if self.get_devices("video"): + return + if not self.get_devices("graphics"): + return self.add_device(virtinst.VirtualVideoDevice(self.conn)) def add_default_usb_controller(self): @@ -533,6 +542,8 @@ class Guest(XMLBuilder): return if not self.os.is_x86(): return + if any([d.type == "usb" for d in self.get_devices("controller")]): + return if not self.conn.check_conn_support( self.conn.SUPPORT_CONN_DEFAULT_USB2): return