mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Re-add serial console support.
This commit is contained in:
@@ -236,6 +236,7 @@ class vmmDetails(gobject.GObject):
|
||||
"on_details_menu_graphics_activate": self.control_vm_console,
|
||||
"on_details_menu_view_toolbar_activate": self.toggle_toolbar,
|
||||
"on_details_menu_view_manager_activate": self.view_manager,
|
||||
"on_details_menu_view_serial_activate": self.control_vm_terminal,
|
||||
|
||||
"on_details_pages_switch_page": self.switch_page,
|
||||
|
||||
@@ -593,6 +594,12 @@ class vmmDetails(gobject.GObject):
|
||||
def update_widget_states(self, vm, status):
|
||||
self.toggle_toolbar(self.window.get_widget("details-menu-view-toolbar"))
|
||||
self.ignorePause = True
|
||||
|
||||
if vm.is_serial_console_tty_accessible():
|
||||
self.window.get_widget("details-menu-view-serial").set_sensitive(True)
|
||||
else:
|
||||
self.window.get_widget("details-menu-view-serial").set_sensitive(False)
|
||||
|
||||
if status in [ libvirt.VIR_DOMAIN_SHUTDOWN, libvirt.VIR_DOMAIN_SHUTOFF ] or vm.is_read_only():
|
||||
# apologies for the spaghetti, but the destroy choice is a special case
|
||||
self.window.get_widget("details-menu-destroy").set_sensitive(False)
|
||||
@@ -605,6 +612,7 @@ class vmmDetails(gobject.GObject):
|
||||
self.window.get_widget("config-vcpus").set_sensitive(True)
|
||||
self.window.get_widget("config-memory").set_sensitive(True)
|
||||
self.window.get_widget("config-maxmem").set_sensitive(True)
|
||||
self.window.get_widget("details-menu-view-serial").set_sensitive(False)
|
||||
else:
|
||||
self.window.get_widget("control-run").set_sensitive(False)
|
||||
self.window.get_widget("details-menu-run").set_sensitive(False)
|
||||
|
||||
@@ -459,6 +459,9 @@ class vmmDomain(gobject.GObject):
|
||||
return self.get_xml_string("/domain/devices/console/@tty")
|
||||
|
||||
def is_serial_console_tty_accessible(self):
|
||||
# pty serial scheme doesn't work over remote
|
||||
if self.connection.is_remote():
|
||||
return False
|
||||
tty = self.get_serial_console_tty()
|
||||
if tty == None:
|
||||
return False
|
||||
|
||||
@@ -36,6 +36,7 @@ from virtManager.asyncjob import vmmAsyncJob
|
||||
from virtManager.create import vmmCreate
|
||||
from virtManager.host import vmmHost
|
||||
from virtManager.error import vmmErrorDialog
|
||||
from virtManager.serialcon import vmmSerialConsole
|
||||
|
||||
class vmmEngine(gobject.GObject):
|
||||
__gsignals__ = {
|
||||
@@ -111,6 +112,10 @@ class vmmEngine(gobject.GObject):
|
||||
if self.connections[hvuri]["windowDetails"].has_key(vmuuid):
|
||||
self.connections[hvuri]["windowDetails"][vmuuid].close()
|
||||
del self.connections[hvuri]["windowDetails"][vmuuid]
|
||||
if self.connections[hvuri]["windowSerialConsole"].has_key(vmuuid):
|
||||
self.connections[hvuri]["windowSerialConsole"][vmuuid].close()
|
||||
del self.connections[hvuri]["windowSerialConsole"][vmuuid]
|
||||
|
||||
|
||||
def _do_connection_changed(self, connection):
|
||||
if connection.get_state() == connection.STATE_ACTIVE:
|
||||
@@ -120,6 +125,9 @@ class vmmEngine(gobject.GObject):
|
||||
for vmuuid in self.connections[hvuri]["windowDetails"].keys():
|
||||
self.connections[hvuri]["windowDetails"][vmuuid].close()
|
||||
del self.connections[hvuri]["windowDetails"][vmuuid]
|
||||
for vmuuid in self.connections[hvuri]["windowSerialConsole"].keys():
|
||||
self.connections[hvuri]["windowSerialConsole"][vmuuid].close()
|
||||
del self.connections[hvuri]["windowSerialConsole"][vmuuid]
|
||||
if self.connections[hvuri]["windowHost"] is not None:
|
||||
self.connections[hvuri]["windowHost"].close()
|
||||
self.connections[hvuri]["windowHost"] = None
|
||||
@@ -246,6 +254,16 @@ class vmmEngine(gobject.GObject):
|
||||
win = self.show_details(uri, uuid)
|
||||
win.activate_console_page()
|
||||
|
||||
def show_serial_console(self, uri, uuid):
|
||||
con = self.get_connection(uri)
|
||||
|
||||
if not(self.connections[uri]["windowSerialConsole"].has_key(uuid)):
|
||||
console = vmmSerialConsole(self.get_config(),
|
||||
con.get_vm(uuid))
|
||||
self.connections[uri]["windowSerialConsole"][uuid] = console
|
||||
self.connections[uri]["windowSerialConsole"][uuid].show()
|
||||
|
||||
|
||||
def refresh_console(self, uri, uuid):
|
||||
con = self.get_connection(uri)
|
||||
|
||||
@@ -294,6 +312,8 @@ class vmmEngine(gobject.GObject):
|
||||
details.connect("action-reboot-domain", self._do_reboot_domain)
|
||||
details.connect("action-exit-app", self._do_exit_app)
|
||||
details.connect("action-view-manager", self._do_show_manager)
|
||||
details.connect("action-show-terminal", self._do_show_terminal)
|
||||
|
||||
except Exception, e:
|
||||
self.err.show_err(_("Error bringing up domain details: %s") % str(e),
|
||||
"".join(traceback.format_exc()))
|
||||
|
||||
@@ -209,6 +209,15 @@
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="details-menu-view-serial">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Serial Console...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_details_menu_view_serial_activate" last_modification_time="Thu, 24 Jul 2008 19:14:47 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator7">
|
||||
<property name="visible">True</property>
|
||||
|
||||
Reference in New Issue
Block a user