diff --git a/ui/addhardware.ui b/ui/addhardware.ui index 55d71bc3a..efa037b16 100644 --- a/ui/addhardware.ui +++ b/ui/addhardware.ui @@ -1,5 +1,5 @@ - + @@ -1190,7 +1190,7 @@ 1 - 2 + 3 1 1 @@ -1205,7 +1205,7 @@ 1 - 6 + 7 1 1 @@ -1218,7 +1218,7 @@ 1 - 3 + 4 1 1 @@ -1269,7 +1269,7 @@ 1 - 4 + 5 1 1 @@ -1320,7 +1320,7 @@ 1 - 5 + 6 1 1 @@ -1336,7 +1336,7 @@ 0 - 2 + 3 1 1 @@ -1352,7 +1352,7 @@ 0 - 3 + 4 1 1 @@ -1368,7 +1368,7 @@ 0 - 4 + 5 1 1 @@ -1384,7 +1384,7 @@ 0 - 5 + 6 1 1 @@ -1400,7 +1400,7 @@ 0 - 6 + 7 1 1 @@ -1446,7 +1446,7 @@ 0 - 1 + 2 1 1 @@ -1457,6 +1457,35 @@ True + + 1 + 2 + 1 + 1 + + + + + True + False + 0 + T_ype: + True + char-target-type + + + 0 + 1 + 1 + 1 + + + + + True + False + start + 1 1 diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index 428772417..042b635b0 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -29,7 +29,7 @@ from gi.repository import Gdk import virtinst from virtinst import util from virtinst import (VirtualChannelDevice, VirtualParallelDevice, - VirtualSerialDevice, + VirtualSerialDevice, VirtualConsoleDevice, VirtualVideoDevice, VirtualWatchdog, VirtualFilesystem, VirtualSmartCardDevice, VirtualRedirDevice, VirtualTPMDevice) @@ -56,20 +56,6 @@ PAGE_USBREDIR = 12 PAGE_TPM = 13 PAGE_RNG = 14 -char_widget_mappings = { - "source_path" : "char-path", - "source_mode" : "char-mode", - "source_host" : "char-host", - "bind_host" : "char-bind-host", - "protocol" : "char-use-telnet", - "target_name" : "char-target-name", -} - - -tpm_widget_mappings = { - "device_path" : "tpm-device-path", -} - class vmmAddHardware(vmmGObjectUI): def __init__(self, vm, is_customize_dialog): @@ -267,6 +253,16 @@ class vmmAddHardware(vmmGObjectUI): desc = VirtualSerialDevice.pretty_mode(t) char_mode_model.append([t, desc + " (%s)" % t]) + # Char target type + lst = self.widget("char-target-type") + model = Gtk.ListStore(str, str) + lst.set_model(model) + uihelpers.set_combo_text_column(lst, 1) + if self.conn.is_qemu(): + model.append(["virtio", "virtio"]) + else: + model.append([None, "default"]) + # Watchdog widgets combo = self.widget("watchdog-model") uihelpers.build_watchdogmodel_combo(self.vm, combo) @@ -350,6 +346,8 @@ class vmmAddHardware(vmmGObjectUI): self.vm.is_hvm(), _("Not supported for this guest type."), "parallel") + add_hw_option("Console", Gtk.STOCK_CONNECT, PAGE_CHAR, + True, None, "console") add_hw_option("Channel", Gtk.STOCK_CONNECT, PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), @@ -449,6 +447,7 @@ class vmmAddHardware(vmmGObjectUI): # Char parameters self.widget("char-device-type").set_active(0) + self.widget("char-target-type").set_active(0) self.widget("char-path").set_text("") self.widget("char-host").set_text("127.0.0.1") self.widget("char-port").set_value(4555) @@ -1033,6 +1032,8 @@ class vmmAddHardware(vmmGObjectUI): return VirtualParallelDevice elif label == "channel": return VirtualChannelDevice + elif label == "console": + return VirtualConsoleDevice return VirtualSerialDevice def dev_to_title(self, page): @@ -1081,6 +1082,10 @@ class vmmAddHardware(vmmGObjectUI): if idx < 0: return + tpm_widget_mappings = { + "device_path" : "tpm-device-path", + } + devtype = src.get_model()[src.get_active()][0] conn = self.conn.get_backend() @@ -1097,6 +1102,16 @@ class vmmAddHardware(vmmGObjectUI): if idx < 0: return + char_widget_mappings = { + "source_path" : "char-path", + "source_mode" : "char-mode", + "source_host" : "char-host", + "bind_host" : "char-bind-host", + "protocol" : "char-use-telnet", + "target_name" : "char-target-name", + "target_type" : "char-target-type", + } + char_class = self.get_char_type() devtype = src.get_model()[src.get_active()][0] conn = self.conn.get_backend() @@ -1504,6 +1519,7 @@ class vmmAddHardware(vmmGObjectUI): charclass = self.get_char_type() modebox = self.widget("char-mode") devbox = self.widget("char-device-type") + typebox = self.widget("char-target-type") devtype = devbox.get_model()[devbox.get_active()][0] conn = self.conn.get_backend() @@ -1517,6 +1533,7 @@ class vmmAddHardware(vmmGObjectUI): source_port = self.widget("char-port").get_value() bind_port = self.widget("char-bind-port").get_value() target_name = self.widget("char-target-name").get_text() + target_type = typebox.get_model()[typebox.get_active()][0] if self.widget("char-use-telnet").get_active(): protocol = VirtualSerialDevice.PROTOCOL_TELNET @@ -1532,6 +1549,7 @@ class vmmAddHardware(vmmGObjectUI): "bind_host": bind_host, "protocol": protocol, "target_name": target_name, + "target_type": target_type, } try: diff --git a/virtinst/devicechar.py b/virtinst/devicechar.py index 244b43d07..a5c684341 100644 --- a/virtinst/devicechar.py +++ b/virtinst/devicechar.py @@ -110,7 +110,6 @@ class _VirtualCharDevice(VirtualDevice): return desc - def supports_property(self, propname, ro=False): """ Whether the character dev type supports the passed property name @@ -124,20 +123,24 @@ class _VirtualCharDevice(VirtualDevice): "protocol" : [self.TYPE_TCP], "bind_host" : [self.TYPE_UDP], "bind_port" : [self.TYPE_UDP], - } + } if ro: users["source_path"] += [self.TYPE_PTY] channel_users = { "target_name" : [self.CHANNEL_TARGET_VIRTIO], - } + } + + console_props = ["target_type"] if users.get(propname): return self.type in users[propname] if channel_users.get(propname): return (self.virtual_device_type == "channel" and self.target_type in channel_users[propname]) + if propname in console_props: + return self.virtual_device_type == "console" return hasattr(self, propname) @@ -256,6 +259,7 @@ class _VirtualCharDevice(VirtualDevice): class VirtualConsoleDevice(_VirtualCharDevice): virtual_device_type = "console" + TYPES = [_VirtualCharDevice.TYPE_PTY] class VirtualSerialDevice(_VirtualCharDevice):