[spice-gtk] session: initialize USB device manager during init

Submitted by marcandre.lureau@redhat.com on Jan. 2, 2019, 11:30 a.m.

Details

Message ID 20190102113015.20257-1-marcandre.lureau@redhat.com
State New
Headers show
Series "session: initialize USB device manager during init" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

marcandre.lureau@redhat.com Jan. 2, 2019, 11:30 a.m.
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Simple command line tools simply connect all channels, however
usbredir channels require that the manager was previously
initialized. Currently, running spicy-stats on a VM with usbredir
channels prints:

(lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: spice_usbredir_channel_up: assertion 'priv->host != NULL' failed

(lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: usbredir_handle_msg: assertion 'priv->host != NULL' failed

There is not strong reason not to initialize the USB device manager
when the session is created.

(when usbredir isn't compiled in, those criticals aren't reached)

Fixes:
https://gitlab.freedesktop.org/spice/spice-gtk/issues/67

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 src/spice-session.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/src/spice-session.c b/src/spice-session.c
index a2ed401..8f4becb 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -283,6 +283,7 @@  static void spice_session_init(SpiceSession *session)
     s->images = cache_image_new((GDestroyNotify)pixman_image_unref);
     s->glz_window = glz_decoder_window_new();
     update_proxy(session, NULL);
+    spice_usb_device_manager_get(session, NULL);
 }
 
 static void

Comments

Hi,

Have you tried with migration?

On Wed, Jan 02, 2019 at 03:30:15PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Simple command line tools simply connect all channels, however
> usbredir channels require that the manager was previously
> initialized. Currently, running spicy-stats on a VM with usbredir
> channels prints:
> 
> (lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: spice_usbredir_channel_up: assertion 'priv->host != NULL' failed
> 
> (lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: usbredir_handle_msg: assertion 'priv->host != NULL' failed
> 
> There is not strong reason not to initialize the USB device manager
> when the session is created.

Yes, I thought so early on but this was breaking the migration
before which lead to the revert

    https://gitlab.freedesktop.org/spice/spice-gtk/commit/139f84da142606bd3e40b9b02bc56e0c86e4fff5

The migration was on usbredir-channel and I think it might be
fixed already but I did not try.

> (when usbredir isn't compiled in, those criticals aren't reached)
> 
> Fixes:
> https://gitlab.freedesktop.org/spice/spice-gtk/issues/67
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  src/spice-session.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/spice-session.c b/src/spice-session.c
> index a2ed401..8f4becb 100644
> --- a/src/spice-session.c
> +++ b/src/spice-session.c
> @@ -283,6 +283,7 @@ static void spice_session_init(SpiceSession *session)
>      s->images = cache_image_new((GDestroyNotify)pixman_image_unref);
>      s->glz_window = glz_decoder_window_new();
>      update_proxy(session, NULL);
> +    spice_usb_device_manager_get(session, NULL);

If migration is not broken, I would suggest

    https://gitlab.freedesktop.org/spice/spice-gtk/commit/291f3e4419e6fb4077ae43a5e09eb1c37b9dd729

as it checks for error and initializes usb-device-manager handler

Cheers,

>  }
>  
>  static void
> -- 
> 2.20.1.2.gb21ebb671b
>