[libvirt] [PATCH v2 3/5] qemu: add virtio video device

Michal Privoznik mprivozn at redhat.com
Fri Nov 27 13:10:10 UTC 2015


On 25.11.2015 09:42, Marc-André Lureau wrote:
> qemu 2.5 provides virtio video device.  It can be used with -device
> virtio-vga for primary devices, or -device virtio-gpu for non-vga
> devices. However, only the primary device (VGA) is supported with this
> patch.
> 
> Reference:
> https://bugzilla.redhat.com/show_bug.cgi?id=1195176
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
> ---
>  docs/formatdomain.html.in                          |    5 +-
>  docs/schemas/domaincommon.rng                      |    1 +
>  src/conf/domain_conf.c                             |    3 +-
>  src/conf/domain_conf.h                             |    1 +
>  src/qemu/qemu_capabilities.c                       |    3 +
>  src/qemu/qemu_capabilities.h                       |    1 +
>  src/qemu/qemu_command.c                            |   12 +-
>  tests/qemucapabilitiesdata/caps_2.4.0-1.caps       |    1 +
>  tests/qemucapabilitiesdata/caps_2.5.0-1.caps       |  166 +
>  tests/qemucapabilitiesdata/caps_2.5.0-1.replies    | 3953 ++++++++++++++++++++
>  tests/qemucapabilitiestest.c                       |    1 +
>  .../qemuxml2argv-video-virtio-gpu-device.args      |   23 +
>  .../qemuxml2argv-video-virtio-gpu-device.xml       |   31 +
>  tests/qemuxml2argvtest.c                           |    4 +
>  tests/qemuxml2xmltest.c                            |    2 +
>  15 files changed, 4200 insertions(+), 7 deletions(-)
>  create mode 100644 tests/qemucapabilitiesdata/caps_2.5.0-1.caps
>  create mode 100644 tests/qemucapabilitiesdata/caps_2.5.0-1.replies
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.xml
> 

> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.args
> new file mode 100644
> index 0000000..762a987
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.args
> @@ -0,0 +1,23 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/bin/qemu \
> +-name QEMUGuest1 \
> +-S \
> +-M pc \
> +-m 1024 \
> +-smp 1 \
> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
> +-nographic \
> +-nodefaults \
> +-monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi \
> +-boot c \
> +-usb \
> +-drive file=/var/lib/libvirt/images/QEMUGuest1,if=none,id=drive-ide0-0-0,format=qcow2,cache=none \

Long line.

> +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
> +-device virtio-vga,id=video0,bus=pci.0,addr=0x2 \
> +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.xml
> new file mode 100644
> index 0000000..e7915b5
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-device.xml
> @@ -0,0 +1,31 @@
> +<domain type='qemu'>
> +  <name>QEMUGuest1</name>
> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>1048576</memory>
> +  <currentMemory unit='KiB'>1048576</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='i686' machine='pc'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <clock offset='utc'/>
> +  <on_poweroff>destroy</on_poweroff>
> +  <on_reboot>restart</on_reboot>
> +  <on_crash>destroy</on_crash>
> +  <devices>
> +    <emulator>/usr/bin/qemu</emulator>
> +    <disk type='file' device='disk'>
> +      <driver name='qemu' type='qcow2' cache='none'/>
> +      <source file='/var/lib/libvirt/images/QEMUGuest1'/>
> +      <target dev='hda' bus='ide'/>
> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> +    </disk>
> +    <controller type='ide' index='0'/>
> +    <controller type='usb' index='0'/>
> +    <controller type='pci' index='0' model='pci-root'/>
> +    <video>
> +      <model type='virtio' heads='1'/>
> +    </video>
> +    <memballoon model='virtio'/>
> +  </devices>
> +</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index dc8654e..1bb0bde 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1748,6 +1748,10 @@ mymain(void)
>      DO_TEST("qemu-ns-commandline-ns0", NONE);
>      DO_TEST("qemu-ns-commandline-ns1", NONE);
>  
> +    DO_TEST("video-virtio-gpu-device",
> +            QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_GPU,
> +            QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
> +

I'd move this to the rest of the video-* tests.

>      qemuTestDriverFree(&driver);
>  
>      return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;

ACK

Michal




More information about the libvir-list mailing list