[virt-tools-list] [PATCH 1/2] Do not show a display when virt-viewer --direct fails

Christophe Fergeau cfergeau at redhat.com
Wed Mar 25 15:47:52 UTC 2015


On Wed, Mar 25, 2015 at 03:54:08PM +0100, Fabiano Fidêncio wrote:
> When --direct fails the expected behavior is to report an error and
> close the dialog, instead of the current behavior, that shows a dialog
> and waits for the guest to connect.

Is it specific to --direct though? It looks to me that we should never
try to wait if virt_viewer_update_display() fails. I think we used to do
that before commits 6100d08 / 9e2f9ea0

Christophe

> 
> Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1085216
> ---
>  src/virt-viewer.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/src/virt-viewer.c b/src/virt-viewer.c
> index e83898b..68dc148 100644
> --- a/src/virt-viewer.c
> +++ b/src/virt-viewer.c
> @@ -474,8 +474,19 @@ virt_viewer_extract_connect_info(VirtViewer *self,
>      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"),
> -                                              priv->domkey);
> +        if (!direct) {
> +            /*
> +             * The distinction made between virt-viewer launched with
> +             * '--direct' consists in:
> +             * 1) virt_viewer_is_reachable() fails: Reporting an error
> +             * to the user and closing the application.
> +             * 2) virt_viewer_is_reachable() doesn't fail: Informing
> +             * the user through a simple dialog and letting virt-viewer
> +             * wait for the guest is the expected behavior.
> +             */
> +            virt_viewer_app_simple_message_dialog(app, _("Guest '%s' is not reachable"),
> +                                                  priv->domkey);
> +        }
>          goto cleanup;
>      }
>  
> @@ -757,8 +768,17 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
>          goto wait;
>      }
>  
> -    if (!virt_viewer_update_display(self, dom))
> +    if (!virt_viewer_update_display(self, dom)) {
> +        if (virt_viewer_app_get_direct(app)) {
> +            gchar *msg = g_strdup_printf(_("Guest '%s' is not reachable"), priv->domkey);
> +            g_set_error_literal(&err, VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED, msg);
> +            g_free(msg);
> +            g_debug("%s", err->message);
> +            goto cleanup;
> +        }
> +
>          goto wait;
> +    }
>  
>      ret = VIRT_VIEWER_APP_CLASS(virt_viewer_parent_class)->initial_connect(app, &err);
>      if (ret || err)
> -- 
> 2.3.3
> 
> _______________________________________________
> 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/20150325/7a953ca7/attachment.sig>


More information about the virt-tools-list mailing list