diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fd2195a67f..d7af60fbd8 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6136,6 +6136,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 )
+
+
+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index c7a0867497..0955fc8764 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3218,6 +3218,11 @@
-->
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c6f5d93909..d3bbbac441 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2352,6 +2352,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
virDomainDeviceInfoClear(&def->info);
VIR_FREE(def->accel);
+ VIR_FREE(def->virtio);
VIR_FREE(def);
}
@@ -13525,11 +13526,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;
@@ -13538,6 +13541,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
char *vgamem = NULL;
char *primary = NULL;
+ ctxt->node = node;
+
if (VIR_ALLOC(def) < 0)
return NULL;
@@ -13639,7 +13644,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);
@@ -14438,7 +14448,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:
@@ -18373,7 +18383,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) {
@@ -19440,6 +19450,10 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
}
}
+ if (src->virtio && dst->virtio &&
+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
+ return false;
+
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
return false;
@@ -23376,6 +23390,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,
@@ -23385,6 +23400,14 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "\n");
virBufferAdjustIndent(buf, 2);
+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+ if (virBufferCheckError(&driverBuf) < 0)
+ return -1;
+ if (virBufferUse(&driverBuf)) {
+ virBufferAddLit(buf, " \n");
+ }
virBufferAsprintf(buf, "ram)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 40258743d7..a692c32e1a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1376,6 +1376,7 @@ struct _virDomainVideoDef {
bool primary;
virDomainVideoAccelDefPtr accel;
virDomainDeviceInfo info;
+ virDomainVirtioOptionsPtr virtio;
};
/* graphics console modes */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
index b7b95014cd..85d1145263 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
@@ -69,6 +69,7 @@
+