On 14.7.2014 13:20, Wang Rui wrote:
From: Zeng Junliang <zengjunliang(a)huawei.com>
The vram attribute is invalid for cirrus and stdvga
device, and default vram value would make us confused.
It would be better to remove it.
Signed-off-by: Zeng Junliang <zengjunliang(a)huawei.com>
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
src/conf/domain_conf.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b91ccf7..63d97ec 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9306,16 +9306,13 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
int type)
{
switch (type) {
- /* Weird, QEMU defaults to 9 MB ??! */
- case VIR_DOMAIN_VIDEO_TYPE_VGA:
- case VIR_DOMAIN_VIDEO_TYPE_CIRRUS:
case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
if (def->virtType == VIR_DOMAIN_VIRT_VBOX)
return 8 * 1024;
else if (def->virtType == VIR_DOMAIN_VIRT_VMWARE)
return 4 * 1024;
else
- return 9 * 1024;
+ return 0;
break;
case VIR_DOMAIN_VIDEO_TYPE_XEN:
@@ -9474,9 +9471,19 @@ virDomainVideoDefParseXML(xmlNodePtr node,
}
if (vram) {
+ /* For type of kvm, vram attribute seems to be invalid
+ * for VIR_DOMAIN_VIDEO_TYPE_VMVGA. Shall we also need
+ * to add judge here? Will it affect other drivers? */
+ if (def->type == VIR_DOMAIN_VIDEO_TYPE_VGA ||
+ def->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("vram attribute is not supported "
+ "for type of vga and cirrus"));
+ goto error;
+ }
if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) {
virReportError(VIR_ERR_XML_ERROR,
- _("cannot parse video ram '%s'"), vram);
+ _("cannot parse video vram '%s'"), vram);
goto error;
}
} else {
We cannot disable use of vram for VGA and CIRRUS because it would be
a regression and all existing domains having this attribute in xml
would not be loaded on libvirtd start. We have to accept the fact that
the vram attribute could be defined for all current video types and
for some of them it will be just ignored.
So don't return error if the vram is set for VGA and CIRRUS.
The only possibility is to silently remove it for qemu in
qemuDomainDevicePostParse function, but that will also requires
updating all qemuxml2argv and qemuxml2xml tests.
Pavel