mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
addhw: Add 'console' option for adding virtio consoles
This commit is contained in:
parent
f9fcac27a0
commit
24137cdfe9
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.16.0 on Sat Sep 28 14:12:31 2013 -->
|
<!-- Generated with glade 3.16.0 on Sat Oct 5 11:25:05 2013 -->
|
||||||
<interface>
|
<interface>
|
||||||
<!-- interface-requires gtk+ 3.0 -->
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
<object class="GtkAdjustment" id="adjustment1">
|
<object class="GtkAdjustment" id="adjustment1">
|
||||||
@ -1190,7 +1190,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">3</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1205,7 +1205,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">6</property>
|
<property name="top_attach">7</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1218,7 +1218,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">4</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1269,7 +1269,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">4</property>
|
<property name="top_attach">5</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1320,7 +1320,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">6</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1336,7 +1336,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">2</property>
|
<property name="top_attach">3</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1352,7 +1352,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">4</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1368,7 +1368,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">4</property>
|
<property name="top_attach">5</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1384,7 +1384,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">5</property>
|
<property name="top_attach">6</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1400,7 +1400,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">6</property>
|
<property name="top_attach">7</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1446,7 +1446,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">2</property>
|
||||||
<property name="width">1</property>
|
<property name="width">1</property>
|
||||||
<property name="height">1</property>
|
<property name="height">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -1457,6 +1457,35 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="char-target-type-label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="label" translatable="yes">T_ype:</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="mnemonic_widget">char-target-type</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="width">1</property>
|
||||||
|
<property name="height">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBox" id="char-target-type">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">1</property>
|
||||||
|
@ -29,7 +29,7 @@ from gi.repository import Gdk
|
|||||||
import virtinst
|
import virtinst
|
||||||
from virtinst import util
|
from virtinst import util
|
||||||
from virtinst import (VirtualChannelDevice, VirtualParallelDevice,
|
from virtinst import (VirtualChannelDevice, VirtualParallelDevice,
|
||||||
VirtualSerialDevice,
|
VirtualSerialDevice, VirtualConsoleDevice,
|
||||||
VirtualVideoDevice, VirtualWatchdog,
|
VirtualVideoDevice, VirtualWatchdog,
|
||||||
VirtualFilesystem, VirtualSmartCardDevice,
|
VirtualFilesystem, VirtualSmartCardDevice,
|
||||||
VirtualRedirDevice, VirtualTPMDevice)
|
VirtualRedirDevice, VirtualTPMDevice)
|
||||||
@ -56,20 +56,6 @@ PAGE_USBREDIR = 12
|
|||||||
PAGE_TPM = 13
|
PAGE_TPM = 13
|
||||||
PAGE_RNG = 14
|
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):
|
class vmmAddHardware(vmmGObjectUI):
|
||||||
def __init__(self, vm, is_customize_dialog):
|
def __init__(self, vm, is_customize_dialog):
|
||||||
@ -267,6 +253,16 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
desc = VirtualSerialDevice.pretty_mode(t)
|
desc = VirtualSerialDevice.pretty_mode(t)
|
||||||
char_mode_model.append([t, desc + " (%s)" % 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
|
# Watchdog widgets
|
||||||
combo = self.widget("watchdog-model")
|
combo = self.widget("watchdog-model")
|
||||||
uihelpers.build_watchdogmodel_combo(self.vm, combo)
|
uihelpers.build_watchdogmodel_combo(self.vm, combo)
|
||||||
@ -350,6 +346,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
self.vm.is_hvm(),
|
self.vm.is_hvm(),
|
||||||
_("Not supported for this guest type."),
|
_("Not supported for this guest type."),
|
||||||
"parallel")
|
"parallel")
|
||||||
|
add_hw_option("Console", Gtk.STOCK_CONNECT, PAGE_CHAR,
|
||||||
|
True, None, "console")
|
||||||
add_hw_option("Channel", Gtk.STOCK_CONNECT, PAGE_CHAR,
|
add_hw_option("Channel", Gtk.STOCK_CONNECT, PAGE_CHAR,
|
||||||
self.vm.is_hvm(),
|
self.vm.is_hvm(),
|
||||||
_("Not supported for this guest type."),
|
_("Not supported for this guest type."),
|
||||||
@ -449,6 +447,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
|
|
||||||
# Char parameters
|
# Char parameters
|
||||||
self.widget("char-device-type").set_active(0)
|
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-path").set_text("")
|
||||||
self.widget("char-host").set_text("127.0.0.1")
|
self.widget("char-host").set_text("127.0.0.1")
|
||||||
self.widget("char-port").set_value(4555)
|
self.widget("char-port").set_value(4555)
|
||||||
@ -1033,6 +1032,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
return VirtualParallelDevice
|
return VirtualParallelDevice
|
||||||
elif label == "channel":
|
elif label == "channel":
|
||||||
return VirtualChannelDevice
|
return VirtualChannelDevice
|
||||||
|
elif label == "console":
|
||||||
|
return VirtualConsoleDevice
|
||||||
return VirtualSerialDevice
|
return VirtualSerialDevice
|
||||||
|
|
||||||
def dev_to_title(self, page):
|
def dev_to_title(self, page):
|
||||||
@ -1081,6 +1082,10 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
if idx < 0:
|
if idx < 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
tpm_widget_mappings = {
|
||||||
|
"device_path" : "tpm-device-path",
|
||||||
|
}
|
||||||
|
|
||||||
devtype = src.get_model()[src.get_active()][0]
|
devtype = src.get_model()[src.get_active()][0]
|
||||||
conn = self.conn.get_backend()
|
conn = self.conn.get_backend()
|
||||||
|
|
||||||
@ -1097,6 +1102,16 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
if idx < 0:
|
if idx < 0:
|
||||||
return
|
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()
|
char_class = self.get_char_type()
|
||||||
devtype = src.get_model()[src.get_active()][0]
|
devtype = src.get_model()[src.get_active()][0]
|
||||||
conn = self.conn.get_backend()
|
conn = self.conn.get_backend()
|
||||||
@ -1504,6 +1519,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
charclass = self.get_char_type()
|
charclass = self.get_char_type()
|
||||||
modebox = self.widget("char-mode")
|
modebox = self.widget("char-mode")
|
||||||
devbox = self.widget("char-device-type")
|
devbox = self.widget("char-device-type")
|
||||||
|
typebox = self.widget("char-target-type")
|
||||||
devtype = devbox.get_model()[devbox.get_active()][0]
|
devtype = devbox.get_model()[devbox.get_active()][0]
|
||||||
conn = self.conn.get_backend()
|
conn = self.conn.get_backend()
|
||||||
|
|
||||||
@ -1517,6 +1533,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
source_port = self.widget("char-port").get_value()
|
source_port = self.widget("char-port").get_value()
|
||||||
bind_port = self.widget("char-bind-port").get_value()
|
bind_port = self.widget("char-bind-port").get_value()
|
||||||
target_name = self.widget("char-target-name").get_text()
|
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():
|
if self.widget("char-use-telnet").get_active():
|
||||||
protocol = VirtualSerialDevice.PROTOCOL_TELNET
|
protocol = VirtualSerialDevice.PROTOCOL_TELNET
|
||||||
@ -1532,6 +1549,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
"bind_host": bind_host,
|
"bind_host": bind_host,
|
||||||
"protocol": protocol,
|
"protocol": protocol,
|
||||||
"target_name": target_name,
|
"target_name": target_name,
|
||||||
|
"target_type": target_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -110,7 +110,6 @@ class _VirtualCharDevice(VirtualDevice):
|
|||||||
|
|
||||||
return desc
|
return desc
|
||||||
|
|
||||||
|
|
||||||
def supports_property(self, propname, ro=False):
|
def supports_property(self, propname, ro=False):
|
||||||
"""
|
"""
|
||||||
Whether the character dev type supports the passed property name
|
Whether the character dev type supports the passed property name
|
||||||
@ -124,20 +123,24 @@ class _VirtualCharDevice(VirtualDevice):
|
|||||||
"protocol" : [self.TYPE_TCP],
|
"protocol" : [self.TYPE_TCP],
|
||||||
"bind_host" : [self.TYPE_UDP],
|
"bind_host" : [self.TYPE_UDP],
|
||||||
"bind_port" : [self.TYPE_UDP],
|
"bind_port" : [self.TYPE_UDP],
|
||||||
}
|
}
|
||||||
|
|
||||||
if ro:
|
if ro:
|
||||||
users["source_path"] += [self.TYPE_PTY]
|
users["source_path"] += [self.TYPE_PTY]
|
||||||
|
|
||||||
channel_users = {
|
channel_users = {
|
||||||
"target_name" : [self.CHANNEL_TARGET_VIRTIO],
|
"target_name" : [self.CHANNEL_TARGET_VIRTIO],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console_props = ["target_type"]
|
||||||
|
|
||||||
if users.get(propname):
|
if users.get(propname):
|
||||||
return self.type in users[propname]
|
return self.type in users[propname]
|
||||||
if channel_users.get(propname):
|
if channel_users.get(propname):
|
||||||
return (self.virtual_device_type == "channel" and
|
return (self.virtual_device_type == "channel" and
|
||||||
self.target_type in channel_users[propname])
|
self.target_type in channel_users[propname])
|
||||||
|
if propname in console_props:
|
||||||
|
return self.virtual_device_type == "console"
|
||||||
return hasattr(self, propname)
|
return hasattr(self, propname)
|
||||||
|
|
||||||
|
|
||||||
@ -256,6 +259,7 @@ class _VirtualCharDevice(VirtualDevice):
|
|||||||
|
|
||||||
class VirtualConsoleDevice(_VirtualCharDevice):
|
class VirtualConsoleDevice(_VirtualCharDevice):
|
||||||
virtual_device_type = "console"
|
virtual_device_type = "console"
|
||||||
|
TYPES = [_VirtualCharDevice.TYPE_PTY]
|
||||||
|
|
||||||
|
|
||||||
class VirtualSerialDevice(_VirtualCharDevice):
|
class VirtualSerialDevice(_VirtualCharDevice):
|
||||||
|
Loading…
Reference in New Issue
Block a user