On 14.07.2014 13:20, Wang Rui wrote:
From: Zeng Junliang <zengjunliang@xxxxxxxxxx>
This patch introduces vgamem attribute for video model, and sets
its default value as qemu used. Parse it in two ways accroding to
qemu startup parameters supported: -device or -vga.
Signed-off-by: Zeng Junliang <zengjunliang@xxxxxxxxxx>
Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx>
---
src/conf/domain_conf.c | 48 ++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 3 +-
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 75 ++++++++++++++++++++++++++++++++----------------
4 files changed, 101 insertions(+), 26 deletions(-)
missing docs and RNG schema adjustment. And I'd introduce a new XML to
test too.
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 63d97ec..d5a65c3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9328,6 +9328,20 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
}
}
+int
+virDomainVideoDefaultVgamem(int type)
+{
+ switch (type) {
+ case VIR_DOMAIN_VIDEO_TYPE_VGA:
+ case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
+ case VIR_DOMAIN_VIDEO_TYPE_QXL:
+ /* QEMU use 16M as default value for vga/vmvga/qxl device*/
+ return 16 * 1024;
+
+ default:
+ return 0;
+ }
+}
int
virDomainVideoDefaultType(const virDomainDef *def)
@@ -9413,6 +9427,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
char *type = NULL;
char *heads = NULL;
char *vram = NULL;
+ char *vgamem = NULL;
char *ram = NULL;
char *primary = NULL;
@@ -9422,11 +9437,12 @@ virDomainVideoDefParseXML(xmlNodePtr node,
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
- if (!type && !vram && !ram && !heads &&
+ if (!type && !vram && !ram && !heads && !vgamem &&
xmlStrEqual(cur->name, BAD_CAST "model")) {
type = virXMLPropString(cur, "type");
ram = virXMLPropString(cur, "ram");
vram = virXMLPropString(cur, "vram");
+ vgamem = virXMLPropString(cur, "vgamem");
heads = virXMLPropString(cur, "heads");
if ((primary = virXMLPropString(cur, "primary")) != NULL) {
@@ -9490,6 +9506,24 @@ virDomainVideoDefParseXML(xmlNodePtr node,
def->vram = virDomainVideoDefaultRAM(dom, def->type);
}
+ if (vgamem) {
+ if (def->type != VIR_DOMAIN_VIDEO_TYPE_VGA &&
+ def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
+ def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("vgamem attribute only supported "
+ "for type of vga, vmvga and qxl"));
+ goto error;
+ }
Spaces at EOL
+ if (virStrToLong_ui(vgamem, NULL, 10, &def->vgamem) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cannot parse video vgamem '%s'"), vgamem);
+ goto error;
+ }
+ } else {
+ def->vgamem = virDomainVideoDefaultVgamem(def->type);
+ }
+
And again.
But I'm wondering how's vgamem different to vram. If it covers the same
attribute but for different models, I'd vote for keeping already
existing attribute name.
Michal
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list