Subject: viewers: spice: Catch failure to setup usbdev manager From: Cole Robinson crobinso@redhat.com Tue Jun 21 09:01:32 2016 -0400 Date: Tue Jun 21 09:01:32 2016 -0400: Git: e69cc002b10b49a77f1cd5170931e5e9209ab240 Since some distros like openbsd don't compile support for usb redirection, which makes this fail https://bugzilla.redhat.com/show_bug.cgi?id=1348479 diff --git a/virtManager/viewers.py b/virtManager/viewers.py index 403c316..2f7d2e9 100644 --- a/virtManager/viewers.py +++ b/virtManager/viewers.py @@ -538,16 +538,23 @@ class SpiceViewer(Viewer): GObject.GObject.connect(self._spice_session, "channel-new", self._channel_new_cb) - self._usbdev_manager = SpiceClientGLib.UsbDeviceManager.get( - self._spice_session) - self._usbdev_manager.connect("auto-connect-failed", - self._usbdev_redirect_error) - self._usbdev_manager.connect("device-error", - self._usbdev_redirect_error) - - autoredir = self.config.get_auto_redirection() - if autoredir: - gtk_session.set_property("auto-usbredir", True) + # Distros might have usb redirection compiled out, like OpenBSD + # https://bugzilla.redhat.com/show_bug.cgi?id=1348479 + try: + self._usbdev_manager = SpiceClientGLib.UsbDeviceManager.get( + self._spice_session) + self._usbdev_manager.connect("auto-connect-failed", + self._usbdev_redirect_error) + self._usbdev_manager.connect("device-error", + self._usbdev_redirect_error) + + autoredir = self.config.get_auto_redirection() + if autoredir: + gtk_session.set_property("auto-usbredir", True) + except: + self._usbdev_manager = None + logging.debug("Error initializing spice usb device manager", + exc_info=True) #####################