diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index bb0b199c17..7ad8aea790 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3565,7 +3565,11 @@ qemu-kvm -net nic,model=? /dev/null video device in domain xml is the primary one, but the optional attribute primary (since 1.0.2) with value 'yes' can be used to mark the primary in cases of mutiple - video device. The non-primary must be type of "qxl". + video device. The non-primary must be type of "qxl". The optional + attribute ram (since + 1.0.2) is allowed for "qxl" type only and specifies + the size of the primary bar, while vram specifies the + secondary bar size. If "ram" is not supplied a default value is used.
model
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 67ae864b39..7f3320e45f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2251,22 +2251,34 @@ - - - vga - cirrus - vmvga - xen - vbox - qxl - - + + + + vga + cirrus + vmvga + xen + vbox + + + + + qxl + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ad6a14a4e7..edbd450eb3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7391,6 +7391,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node, char *type = NULL; char *heads = NULL; char *vram = NULL; + char *ram = NULL; char *primary = NULL; if (VIR_ALLOC(def) < 0) { @@ -7401,9 +7402,10 @@ virDomainVideoDefParseXML(const xmlNodePtr node, cur = node->children; while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { - if (!type && !vram && !heads && + if (!type && !vram && !ram && !heads && xmlStrEqual(cur->name, BAD_CAST "model")) { type = virXMLPropString(cur, "type"); + ram = virXMLPropString(cur, "ram"); vram = virXMLPropString(cur, "vram"); heads = virXMLPropString(cur, "heads"); @@ -7431,9 +7433,24 @@ virDomainVideoDefParseXML(const xmlNodePtr node, } } + if (ram) { + if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("ram attribute only supported for type of qxl")); + goto error; + } + if (virStrToLong_ui(ram, NULL, 10, &def->ram) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse video ram '%s'"), ram); + goto error; + } + } else if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { + def->ram = virDomainVideoDefaultRAM(dom, def->type); + } + if (vram) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_XML_ERROR, _("cannot parse video ram '%s'"), vram); goto error; } @@ -7455,6 +7472,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node, goto error; VIR_FREE(type); + VIR_FREE(ram); VIR_FREE(vram); VIR_FREE(heads); @@ -13384,6 +13402,8 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAddLit(buf, "