<video>
<driver compatibility='modern'/>
<model type='virtio' heads='1' primary='yes'/>
</video>
https://bugzilla.redhat.com/show_bug.cgi?id=1227354
---
docs/formatdomain.html.in | 8 ++++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 17 +++++++++++++++--
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml | 1 +
.../qemuxml2xmlout-virtio-revision.xml | 1 +
6 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 41a9325..d640e8d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5641,6 +5641,14 @@ qemu-kvm -net nic,model=? /dev/null
The optional <code>address</code> sub-element can be used to
tie the video device to a particular PCI slot.
</dd>
+
+ <dt><code>driver</code></dt>
+ <dd>
+ The <code>compatibility</code> attribute can be used to specify the
+ compatibility of virtio devices. Allowed values are
<code>legacy</code>,
+ <code>transitional</code> and <code>modern</code>.
+ <span class="since">Since 2.2.0</span>.
+ </dd>
</dl>
<h4><a name="elementsConsole">Consoles, serial, parallel
& channel devices</a></h4>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ed00ace..f250cbc 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3080,6 +3080,11 @@
<define name="video">
<element name="video">
<optional>
+ <element name="driver">
+ <ref name="compatibility"/>
+ </element>
+ </optional>
+ <optional>
<element name="model">
<choice>
<attribute name="type">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 166f5fb..03c856c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12605,11 +12605,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;
@@ -12618,6 +12620,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
char *vgamem = NULL;
char *primary = NULL;
+ ctxt->node = node;
+
if (VIR_ALLOC(def) < 0)
return NULL;
@@ -12719,7 +12723,12 @@ virDomainVideoDefParseXML(xmlNodePtr node,
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
goto error;
+ if (virDomainDriverCompatibilityParseXML(ctxt, &def->compatibility) < 0)
+ goto error;
+
cleanup:
+ ctxt->node = saved;
+
VIR_FREE(type);
VIR_FREE(ram);
VIR_FREE(vram);
@@ -13414,7 +13423,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:
@@ -17084,7 +17093,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) {
@@ -21896,6 +21905,10 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAddLit(buf, "<video>\n");
virBufferAdjustIndent(buf, 2);
+ if (def->compatibility) {
+ virBufferAsprintf(buf, "<driver compatibility='%s'/>\n",
+
virDomainDriverCompatibilityTypeToString(def->compatibility));
+ }
virBufferAsprintf(buf, "<model type='%s'",
model);
if (def->ram)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 342218e..ecccc0a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1322,6 +1322,7 @@ struct _virDomainVideoDef {
bool primary;
virDomainVideoAccelDefPtr accel;
virDomainDeviceInfo info;
+ virDomainDriverCompatibility compatibility;
};
/* graphics console modes */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 5b9726a..fecf9e5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -86,6 +86,7 @@
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<video>
+ <driver compatibility='modern'/>
<model type='virtio' heads='1' primary='yes'>
<acceleration accel3d='yes'/>
</model>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index ab69bb7..f1c728e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -86,6 +86,7 @@
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<video>
+ <driver compatibility='modern'/>
<model type='virtio' heads='1' primary='yes'>
<acceleration accel3d='yes'/>
</model>
--
2.7.3