From: Zeng Junliang <zengjunliang@xxxxxxxxxx> The vram attribute is never used for VGA, CIRRUS and VMVGA as QEMU has no vram attribute for these models. Hide it for qemu in qemuDomainDevicePostParse function. And update the corresponding test cases and descriptions. Signed-off-by: Zeng Junliang <zengjunliang@xxxxxxxxxx> Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx> --- docs/formatdomain.html.in | 24 +++++++++++----------- src/qemu/qemu_command.c | 3 ++- src/qemu/qemu_domain.c | 12 +++++++++++ ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-controller-order.xml | 2 +- .../qemuxml2argv-graphics-listen-network.xml | 2 +- .../qemuxml2argv-graphics-listen-network2.xml | 2 +- .../qemuxml2argv-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 2 +- .../qemuxml2argv-graphics-spice-agentmouse.xml | 2 +- .../qemuxml2argv-graphics-spice-timeout.xml | 2 +- .../qemuxml2argv-graphics-vnc-policy.xml | 2 +- .../qemuxml2argv-graphics-vnc-sasl.xml | 2 +- .../qemuxml2argv-graphics-vnc-socket.xml | 2 +- .../qemuxml2argv-graphics-vnc-tls.xml | 2 +- .../qemuxml2argv-graphics-vnc-websocket.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 2 +- .../qemuxml2argv-net-bandwidth.xml | 2 +- .../qemuxml2argv-pci-autoadd-addr.xml | 2 +- .../qemuxml2argv-pci-autoadd-idx.xml | 2 +- tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- 27 files changed, 50 insertions(+), 37 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bd99ae0..3012e3c 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4419,7 +4419,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <video> - <model type='vga' vram='8192' heads='1'> + <model type='vga' heads='1'> <acceleration accel3d='yes' accel2d='yes'/> </model> </video> @@ -4434,17 +4434,16 @@ qemu-kvm -net nic,model=? /dev/null is set but there is a <code>graphics</code> in domain xml, then libvirt will add a default <code>video</code> according to the guest type. For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", <code>vram</code> with value - "9216", and <code>heads</code> with value "1". By default, the first - video device in domain xml is the primary one, but the optional - attribute <code>primary</code> (<span class="since">since 1.0.2</span>) - with value 'yes' can be used to mark the primary in cases of multiple - video device. The non-primary must be type of "qxl". The optional - attribute <code>ram</code> (<span class="since">since - 1.0.2</span>) is allowed for "qxl" type only and specifies - the size of the primary bar, while <code>vram</code> specifies the - secondary bar size. If "ram" or "vram" are not supplied a default - value is used. + <code>type</code> with value "cirrus", and <code>heads</code> with + value "1". By default, the first video device in domain xml is the + primary one, but the optional attribute <code>primary</code> + (<span class="since">since 1.0.2</span>) with value 'yes' can be + used to mark the primary in cases of multiple video device. + The non-primary must be type of "qxl". The optional attribute + <code>ram</code> (<span class="since">since 1.0.2</span>) is allowed + for "qxl" type only and specifies the size of the primary bar, + while <code>vram</code> specifies the secondary bar size. + If "ram" or "vram" are not supplied a default value is used. </dd> <dt><code>model</code></dt> @@ -4456,6 +4455,7 @@ qemu-kvm -net nic,model=? /dev/null You can also provide the amount of video memory in kibibytes (blocks of 1024 bytes) using <code>vram</code> and the number of screen with <code>heads</code>. + For type of kvm <code>vram</code> attribute is only valid for "qxl". </dd> <dt><code>acceleration</code></dt> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8a69976..c3f860e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11766,7 +11766,8 @@ qemuParseCommandLine(virCapsPtr qemuCaps, vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN; else vid->type = video; - vid->vram = virDomainVideoDefaultRAM(def, vid->type); + vid->vram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? + virDomainVideoDefaultRAM(def, vid->type) : 0; vid->ram = vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL ? virDomainVideoDefaultRAM(def, vid->type) : 0; vid->heads = 1; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e9506e0..9b02f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -950,6 +950,18 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, goto cleanup; } + /* hide the confusing vram attribute which is never used + * for VGA, CIRRUS and VMVGA devices */ + if (dev->type == VIR_DOMAIN_DEVICE_VIDEO && + (dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VGA || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS || + dev->data.video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA)) { + VIR_DEBUG("Hide the confusing vram attribute here, " + "which is never used for VGA, CIRRUS and " + "VMVGA devices"); + dev->data.video->vram = 0; + } + ret = 0; cleanup: diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index ec1c6e8..6ee2b58 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -91,7 +91,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml index 4d4ac47..bae4ff2a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml @@ -88,7 +88,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml index 6a98eaa..519109f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.xml @@ -73,7 +73,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='usb' managed='yes'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml index 98b7d6a..d1ca28c 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network.xml @@ -28,7 +28,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml index aa458d7..e3e2b46 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-listen-network2.xml @@ -28,7 +28,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml index 0177654..895c76e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml index 6bebd10..cb6c774 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml index 113a236..bad60e8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml @@ -32,7 +32,7 @@ <address type='virtio-serial' controller='1' bus='0' port='3'/> </channel> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml index e6ecbed..b5940f4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-timeout.xml @@ -77,7 +77,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml index 694343f..8e5b17b 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml index b35c2bd..30437d3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml index 44df226..f58c237 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-socket.xml @@ -27,7 +27,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='vnc' socket='/tmp/foo.socket'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml index b35c2bd..30437d3 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml @@ -29,7 +29,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml index cfa61be..0c27493 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-websocket.xml @@ -22,7 +22,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml index 356ac36..b6f49e8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml @@ -29,7 +29,7 @@ <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml index f70e20a..19155ac 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-bandwidth.xml @@ -66,7 +66,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml index 92db5e6..a1cef80 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-addr.xml @@ -34,7 +34,7 @@ </controller> <input type='mouse' bus='ps2'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml index f6a3ddf..881f3e0 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-autoadd-idx.xml @@ -35,7 +35,7 @@ <controller type='pci' index='8' model='pci-bridge'/> <input type='mouse' bus='ps2'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml index a1cb38c..d2771e5 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pci-bridge.xml @@ -201,7 +201,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml index 1f896f8..71c844e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml @@ -34,7 +34,7 @@ <input type='mouse' bus='usb'/> <graphics type='sdl'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='none'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml index ae40805..f4103c2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml @@ -29,7 +29,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> </video> <memballoon model='virtio'/> </devices> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 44c4cf7..8a319a2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -80,7 +80,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='9216' heads='1'/> + <model type='vga' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml index 13f0f5d..d8abb9d 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml @@ -34,7 +34,7 @@ </controller> <controller type='pci' index='0' model='pci-root'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml index 8748437..a4c22e3 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml @@ -35,7 +35,7 @@ <controller type='pci' index='8' model='pci-bridge'/> <controller type='pci' index='0' model='pci-root'/> <video> - <model type='cirrus' vram='9216' heads='1'/> + <model type='cirrus' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> -- 1.7.12.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list