diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8c89b0cf3ffc0eda366e60bdf3b7562e6f233776..f1e6781a7a36e3ab001f9a2f4d47cce4cb2a58dc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9212,11 +9212,22 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-vga", vgastr, NULL); + /* If we cannot use --device option to specify the video device + * in QEMU we will fallback to the old --vga option. To get the + * correct device name for the --vga option the 'qemuVideo' is + * used, but to set some device attributes we need to use the + * --global option and for that we need to specify the device + * name the same as for --device option and for that we need to + * use 'qemuDeviceVideo'. + * + * See 'Graphics Devices' section in docs/qdev-device-use.txt in + * QEMU repository. + */ + const char *dev = qemuDeviceVideoTypeToString(primaryVideoType); + if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && (def->videos[0]->vram || def->videos[0]->ram) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) - ? "qxl-vga" : "qxl"); unsigned int ram = def->videos[0]->ram; unsigned int vram = def->videos[0]->vram; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args index cdc916c46545bff16ffb31c94d656045b9715764..e08ee208774d45544fa3bfd7aa4dd15c91f54e8b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args @@ -6,6 +6,6 @@ x509-dir=/etc/pki/libvirt-spice,\ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter -vga \ -qxl -global qxl.ram_size=67108864 -global qxl.vram_size=33554432 \ +qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 \ -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args index 0c9df167816bd65b33bee57f103a34de75bfd26d..4f7f09b8e4eeb56c64d6ae2e92b0b8bc25103eec 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args @@ -5,5 +5,5 @@ SASL_CONF_PATH=/root/.sasl2 QEMU_AUDIO_DRV=spice \ /dev/HostVG/QEMUGuest1 \ -spice port=5903,tls-port=5904,sasl,addr=127.0.0.1,\ x509-dir=/etc/pki/libvirt-spice,tls-channel=default \ --vga qxl -global qxl.ram_size=67108864 -global \ -qxl.vram_size=33554432 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args index 704cec75a5e670da7b9704c47465c0cf1c938c63..97755c3939612cbe6bba6b886dc06aee463c01ad 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -7,7 +7,7 @@ plaintext-channel=inputs,\ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter,disable-copy-paste,\ -disable-agent-file-xfer -vga qxl -global qxl.ram_size=67108864 \ --global qxl.vram_size=33554432 \ +disable-agent-file-xfer -vga qxl -global qxl-vga.ram_size=67108864 \ +-global qxl-vga.vram_size=33554432 \ -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args index c8045a49794ab38f2d6ce46d731f0c3e4d87f5cb..cd2cccab80e36068ea02b7cf3c43e16f850a5399 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args @@ -6,4 +6,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=33554432 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args index 08bd96e61fd1c29a07a401680699bdd4f7a1fe2c..888aa6bf5292d6d42a52ac0ebccf4a36c375d1f8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args @@ -5,4 +5,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=33554432 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432