[virt-tools-list] [PATCH] Take --direct into consideration when checking if a guest is reachable
Christophe Fergeau
cfergeau at redhat.com
Wed Mar 11 17:16:34 UTC 2015
On Wed, Mar 11, 2015 at 04:27:37PM +0100, Fabiano Fidêncio wrote:
> When connecting to a remote host that has a virtual machine listening to
> "127.0.0.1", virt_viewer_is_reachable() must take --direct into account,
> otherwise it can end up connecting to a local virtual machine listening
> to "0.0.0.0" instead of return that the guest is not reachable.
You could be a bit more specific here and indicate that the problem was
with qemu+ssh.
Patch looks good to me, but I hope virt_viewer_is_reachable won't get
more complicated than that. ACK.
>
> Resolves: rhbz#1085216
> ---
> src/virt-viewer.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index e4bca74..acad6c6 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -355,8 +355,10 @@ virt_viewer_is_loopback(const char *host)
>
>
> static gboolean
> -virt_viewer_is_reachable(const gchar *host, const char *transport,
> - const char *transport_host)
> +virt_viewer_is_reachable(const gchar *host,
> + const char *transport,
> + const char *transport_host,
> + gboolean direct)
> {
> gboolean host_is_loopback;
> gboolean transport_is_loopback;
> @@ -367,7 +369,7 @@ virt_viewer_is_reachable(const gchar *host, const char *transport,
> if (!transport)
> return TRUE;
>
> - if (strcmp(transport, "ssh") == 0)
> + if (strcmp(transport, "ssh") == 0 && !direct)
> return TRUE;
>
> if (strcmp(transport, "unix") == 0)
> @@ -402,6 +404,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
> gchar *user = NULL;
> gint port = 0;
> gchar *uri = NULL;
> + gboolean direct = virt_viewer_app_get_direct(app);
>
> virt_viewer_app_free_connect_info(app);
>
> @@ -457,8 +460,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
> */
> if (virt_viewer_replace_host(ghost)) {
> gchar *replacement_host = NULL;
> - if ((g_strcmp0(transport, "ssh") == 0)
> - && !virt_viewer_app_get_direct(app)) {
> + if ((g_strcmp0(transport, "ssh") == 0) && !direct) {
> replacement_host = g_strdup("localhost");
> } else {
> replacement_host = g_strdup(host);
> @@ -469,7 +471,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
> ghost = replacement_host;
> }
>
> - if (!virt_viewer_is_reachable(ghost, transport, host)) {
> + if (!virt_viewer_is_reachable(ghost, transport, host, direct)) {
> g_debug("graphics listen '%s' is not reachable from this machine",
> ghost ? ghost : "");
> virt_viewer_app_simple_message_dialog(app, _("Guest '%s' is not reachable"),
> --
> 2.3.1
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150311/6eb8c951/attachment.sig>
More information about the virt-tools-list
mailing list