[et-mgmt-tools] Re: [PATCH] use localhost when connecting local VNC guest console
Bernhard Kaindl
bk at suse.de
Fri Aug 31 17:05:43 UTC 2007
On Fri, 31 Aug 2007, Bernhard Kaindl wrote:
> and if that is so (both are the hostname of the local machine) then
> the VNC connection can be directed to 127.0.0.1 as before:
>
> --- virt-manager--devel/src/virtManager/domain.py
> +++ virt-manager--devel/src/virtManager/domain.py
> @@ -456,7 +456,12 @@ def get_graphics_console(self):
>
> transport, username = self.connection.get_transport()
>
> - return [type, self.connection.get_hostname(), port, transport]
> + hostname = self.connection.get_hostname()
> +
> + if hostname == self.connection.get_local_hostname():
> + hostname = "127.0.0.1"
> +
> + return [type, hostname, port, transport]
>
>
> def get_disk_devices(self):
Note: The message which was displayed when the gtk-vnc widget got the
ECONNREFUSED (Connection refused) error when connecting to <hostname>:5900
sounds a bit misleading to me.
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(5900), sin_addr=inet_addr("<my host's LAN IP address here>")}, 16) = -1 ECONNREFUSED (Connection refused)
The message resulting from this was:
"Console was disconnected from guest"
It's shown by:
virt-manager-0.5.0/src/virtManager/console.py:234
def _vnc_disconnected(self, src):
logging.debug("VNC disconnected")
self.vncViewerFailures = self.vncViewerFailures + 1
self.activate_unavailable_page(_("Console was disconnected from guest"))
which is connected with:
virt-manager-0.5.0/src/virtManager/console.py:58
self.vncViewer.connect("vnc-disconnected", self._vnc_disconnected)
which itself is connected with:
/usr/share/doc/gtk-vnc-python-0.1.0/gvncviewer.py:173
vnc.connect("vnc-disconnected", vnc_disconnected)
originating from gtk-vnc-0.1.0/src/vncdisplay.c:
signals[VNC_DISCONNECTED] =
g_signal_new ("vnc-disconnected",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (VncDisplayClass, vnc_disconnected),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
Unfortunately, gtk-vnc does not seem ot have a signal for VNC_CONNECTION_REFUSED
yet, it seems. I think that is something to push for to get accurate signal
info in this case to be able to possibly handle that in a more specific way.
Bernhard
More information about the et-mgmt-tools
mailing list