From 5ac933e98aac11800feba10092edb2a7473e34fc Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 25 Nov 2017 17:23:59 -0500 Subject: [PATCH] guest: Set default rendernode= if spice gl requested Since this is required to work out of the box with qemu:///system --- .../compare/virt-install-many-devices.xml | 4 ++-- .../compare/virt-install-spice-gl.xml | 2 +- virtinst/guest.py | 18 +++++++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml index 2873a65bd..20752ee73 100644 --- a/tests/cli-test-xml/compare/virt-install-many-devices.xml +++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml @@ -235,12 +235,12 @@ - + - + diff --git a/tests/cli-test-xml/compare/virt-install-spice-gl.xml b/tests/cli-test-xml/compare/virt-install-spice-gl.xml index 0aef6aa70..095c43e5d 100644 --- a/tests/cli-test-xml/compare/virt-install-spice-gl.xml +++ b/tests/cli-test-xml/compare/virt-install-spice-gl.xml @@ -44,7 +44,7 @@ - + diff --git a/virtinst/guest.py b/virtinst/guest.py index eaf83ffc2..44554d437 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -1174,9 +1174,21 @@ class Guest(XMLBuilder): if dev.image_compression is None: dev.image_compression = "off" - if (dev.type == "spice" and dev.gl and - not self.conn.check_support(self.conn.SUPPORT_CONN_SPICE_GL)): - raise ValueError(_("Host does not support spice GL")) + if dev.type == "spice" and dev.gl: + if not self.conn.check_support( + self.conn.SUPPORT_CONN_SPICE_GL): + raise ValueError(_("Host does not support spice GL")) + + # If spice GL but rendernode wasn't specified, hardcode + # the first one + if not dev.rendernode and self.conn.check_support( + self.conn.SUPPORT_CONN_SPICE_RENDERNODE): + for nodedev in self.conn.fetch_all_nodedevs(): + if (nodedev.device_type != 'drm' or + nodedev.drm_type != 'render'): + continue + dev.rendernode = nodedev.get_devnode().path + break def _add_spice_channels(self): if self.skip_default_channel: