From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx> 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 <marcandre.lureau@xxxxxxxxxx> --- .../cli-test-xml/compare/virt-install-spice-gl.xml | 69 ++++++++++++++++++++++ tests/clitest.py | 7 +++ virtinst/guest.py | 7 +++ virtinst/osdict.py | 5 +- 4 files changed, 87 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 0000000..ef1e855 --- /dev/null +++ b/tests/cli-test-xml/compare/virt-install-spice-gl.xml @@ -0,0 +1,69 @@ +<domain type="kvm"> + <name>foobar</name> + <uuid>00000000-1111-2222-3333-444444444444</uuid> + <memory>1048576</memory> + <currentMemory>1048576</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch="x86_64">hvm</type> + <boot dev="hd"/> + </os> + <features> + <acpi/> + <apic/> + <vmport state="off"/> + </features> + <cpu mode="custom" match="exact"> + <model>Opteron_G4</model> + </cpu> + <clock offset="utc"> + <timer name="rtc" tickpolicy="catchup"/> + <timer name="pit" tickpolicy="delay"/> + <timer name="hpet" present="no"/> + </clock> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>restart</on_crash> + <pm> + <suspend-to-mem enabled="no"/> + <suspend-to-disk enabled="no"/> + </pm> + <devices> + <emulator>/usr/bin/qemu-kvm</emulator> + <controller type="usb" index="0" model="ich9-ehci1"/> + <controller type="usb" index="0" model="ich9-uhci1"> + <master startport="0"/> + </controller> + <controller type="usb" index="0" model="ich9-uhci2"> + <master startport="2"/> + </controller> + <controller type="usb" index="0" model="ich9-uhci3"> + <master startport="4"/> + </controller> + <interface type="bridge"> + <source bridge="eth0"/> + <mac address="00:11:22:33:44:55"/> + <model type="virtio"/> + </interface> + <input type="tablet" bus="usb"/> + <graphics type="spice" gl="yes" port="-1" tlsPort="-1" autoport="yes"> + <image compression="off"/> + </graphics> + <console type="pty"/> + <channel type="unix"> + <source mode="bind"/> + <target type="virtio" name="org.qemu.guest_agent.0"/> + </channel> + <channel type="spicevmc"> + <target type="virtio" name="com.redhat.spice.0"/> + </channel> + <sound model="ich6"/> + <video> + <model type="virtio"> + <acceleration accel3d="yes"/> + </model> + </video> + <redirdev bus="usb" type="spicevmc"/> + <redirdev bus="usb" type="spicevmc"/> + </devices> +</domain> diff --git a/tests/clitest.py b/tests/clitest.py index 9d357c7..57934f3 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 f36a09d..da07410 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 704fbc6..9f9679c 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" -- 2.5.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list