From ea1bd169c1d2e72b93998278e23a6fa30a8c5c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 4 Mar 2016 12:31:53 +0100 Subject: [PATCH] virtinst: use virtio if spice+gl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use virtio+accel3d by default whenever spice+gl is chosen. This allows to easily set up accelerated gpu VM. Signed-off-by: Marc-André Lureau --- .../compare/virt-install-spice-gl.xml | 70 +++++++++++++++++++ tests/clitest.py | 7 ++ virtinst/guest.py | 7 ++ virtinst/osdict.py | 5 +- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 tests/cli-test-xml/compare/virt-install-spice-gl.xml diff --git a/tests/cli-test-xml/compare/virt-install-spice-gl.xml b/tests/cli-test-xml/compare/virt-install-spice-gl.xml new file mode 100644 index 000000000..44a67003d --- /dev/null +++ b/tests/cli-test-xml/compare/virt-install-spice-gl.xml @@ -0,0 +1,70 @@ + + foobar + 00000000-1111-2222-3333-444444444444 + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + Opteron_G4 + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-kvm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/clitest.py b/tests/clitest.py index 9d357c79a..57934f3ae 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -529,6 +529,13 @@ c.add_compare(""" \ """, "many-devices", compare_check=support.SUPPORT_CONN_RBD_FORMAT) +c.add_compare(""" \ +--memory 1024 \ +--disk none \ +--graphics spice,gl=yes \ +""", "spice-gl", compare_check=support.SUPPORT_CONN_VMPORT) + + #################################################### # CPU/RAM/numa and other singleton VM config tests # diff --git a/virtinst/guest.py b/virtinst/guest.py index f36a09d01..da0741091 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -1183,6 +1183,11 @@ class Guest(XMLBuilder): if gfx.type == gfx.TYPE_SPICE: return True + def has_gl(self): + for gfx in self.get_devices("graphics"): + if gfx.gl: + return True + def _set_video_defaults(self): if self.has_spice(): self._add_spice_channels() @@ -1196,3 +1201,5 @@ class Guest(XMLBuilder): for video in self.get_devices("video"): if video.model == video.MODEL_DEFAULT: video.model = video_model + if video.model == 'virtio' and self.has_gl(): + video.accel3d = True diff --git a/virtinst/osdict.py b/virtinst/osdict.py index 704fbc64f..9f9679c0b 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -522,7 +522,10 @@ class _OsVariant(object): return "vmvga" if guest.has_spice() and guest.os.is_x86(): - return "qxl" + if guest.has_gl(): + return "virtio" + else: + return "qxl" if self.is_windows(): return "vga"