[virt-tools-list] [virt-viewer] ovirt: Fix initial connection

Eduardo Lima (Etrunko) etrunko at redhat.com
Thu Dec 6 13:28:05 UTC 2018


On 12/6/18 10:41 AM, Christophe Fergeau wrote:
> After commit df42f78d46 "remote-viewer: factor our
> remote_viewer_initial_connect()", the initial connection code only gets
> run in the !ovirt case. When ovirt is in use, the initial connection
> never happens, meaning all we get when using ovirt:// is a blank
> virt-viewer window.
> 
> This commit fixes that by moving creation of the ovirt session to
> remote_viewer_initial_connect, and unconditionnally calling the
> remote_viewer_initial_connect rather than only doing it in the !ovirt
> case.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1655537
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  src/remote-viewer.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index 4e1021b..989466b 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -684,9 +684,18 @@ remote_viewer_initial_connect(RemoteViewer *self, const gchar *type, const gchar
>  {
>      VirtViewerApp *app = VIRT_VIEWER_APP(self);
>  
> -    if (!virt_viewer_app_create_session(app, type, error))
> -        return FALSE;
> -
> +#ifdef HAVE_OVIRT
> +    if (g_strcmp0(type, "ovirt") == 0) {
> +        if (!create_ovirt_session(app, guri, error)) {
> +            g_prefix_error(error, _("Couldn't open oVirt session: "));
> +            return FALSE;
> +        }
> +    } else
> +#endif
> +    {
> +        if (!virt_viewer_app_create_session(app, type, error))
> +            return FALSE;
> +    }
>  
>      g_signal_connect(virt_viewer_app_get_session(app), "session-connected",
>                       G_CALLBACK(remote_viewer_session_connected), g_strdup(guri));
> @@ -782,18 +791,8 @@ retry_dialog:
>                                  _("Cannot determine the connection type from URI"));
>              goto cleanup;
>          }
> -#ifdef HAVE_OVIRT
> -        if (g_strcmp0(type, "ovirt") == 0) {
> -            if (!create_ovirt_session(app, guri, &error)) {
> -                g_prefix_error(&error, _("Couldn't open oVirt session: "));
> -                goto cleanup;
> -            }
> -        } else
> -#endif
> -        {
> -            if (!remote_viewer_initial_connect(self, type, guri, vvfile, &error))
> -                goto cleanup;
> -        }
> +        if (!remote_viewer_initial_connect(self, type, guri, vvfile, &error))
> +            goto cleanup;
>      }
>  
>      ret = VIRT_VIEWER_APP_CLASS(remote_viewer_parent_class)->start(app, &error);
> 
Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>

-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list