From 6abf3f12df5173dc12af69827fbee98811f83959 Mon Sep 17 00:00:00 2001 Message-Id: <6abf3f12df5173dc12af69827fbee98811f83959@dist-git> From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 9 Jun 2017 12:49:06 +0200 Subject: [PATCH] Add virtio-related options to video MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugzilla.redhat.com/show_bug.cgi?id=1283251 Reviewed-by: Pavel Hrdina (cherry picked from commit f5384fb4029a59624e728a2e0d37e6a62efbdc52) Signed-off-by: Ján Tomko Signed-off-by: Jiri Denemark --- docs/formatdomain.html.in | 12 ++++++++++ docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 27 ++++++++++++++++++++-- src/conf/domain_conf.h | 1 + .../qemuxml2argv-virtio-options.xml | 1 + 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 2e5c669c4a..6be015f866 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6133,6 +6133,18 @@ qemu-kvm -net nic,model=? /dev/null The optional address sub-element can be used to tie the video device to a particular PCI slot. + +
driver
+
+ The subelement driver can be used to tune the device: +
+
virtio options
+
+ Virtio-specific options can also be + set. (Since 3.5.0) +
+
+

Consoles, serial, parallel & channel devices

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7e80275029..ee49d6eb58 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3165,6 +3165,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 059c006b69..a0de639e51 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2339,6 +2339,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def) virDomainDeviceInfoClear(&def->info); VIR_FREE(def->accel); + VIR_FREE(def->virtio); VIR_FREE(def); } @@ -13499,11 +13500,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) static virDomainVideoDefPtr virDomainVideoDefParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt, const virDomainDef *dom, unsigned int flags) { virDomainVideoDefPtr def; xmlNodePtr cur; + xmlNodePtr saved = ctxt->node; char *type = NULL; char *heads = NULL; char *vram = NULL; @@ -13512,6 +13515,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, char *vgamem = NULL; char *primary = NULL; + ctxt->node = node; + if (VIR_ALLOC(def) < 0) return NULL; @@ -13613,7 +13618,12 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) goto error; + if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) + goto error; + cleanup: + ctxt->node = saved; + VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); @@ -14412,7 +14422,7 @@ virDomainDeviceDefParse(const char *xmlStr, goto error; break; case VIR_DOMAIN_DEVICE_VIDEO: - if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags))) + if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags))) goto error; break; case VIR_DOMAIN_DEVICE_HOSTDEV: @@ -18347,7 +18357,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainVideoDefPtr video; ssize_t insertAt = -1; - if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags))) + if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags))) goto error; if (video->primary) { @@ -19414,6 +19424,10 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, } } + if (src->virtio && dst->virtio && + !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + return false; + if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) return false; @@ -23332,6 +23346,7 @@ virDomainVideoDefFormat(virBufferPtr buf, unsigned int flags) { const char *model = virDomainVideoTypeToString(def->type); + virBuffer driverBuf = VIR_BUFFER_INITIALIZER; if (!model) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -23341,6 +23356,14 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAddLit(buf, "