<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<virtio revision='1.0'/>
</rng>
https://bugzilla.redhat.com/show_bug.cgi?id=1227354
---
docs/formatdomain.html.in | 9 +++++++++
docs/schemas/domaincommon.rng | 3 +++
src/conf/domain_conf.c | 5 +++++
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml | 5 +++++
tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml | 5 +++++
6 files changed, 28 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 9998447..b595674 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6538,6 +6538,15 @@ qemu-kvm -net nic,model=? /dev/null
</dd>
</dl>
</dd>
+ <dt><code>virtio</code></dt>
+ <dd>
+ <p>
+ An optional <code>virtio</code> element can be used to enforce a
particular
+ virtio revision in QEMU. The valid values for the
<code>revision</code>
+ are <code>0.9</code> and <code>1.0</code>.
+ <span class='since'>Since 2.2.0</span>
+ </p>
+ </dd>
</dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index c106cc1..2909edf 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4804,6 +4804,9 @@
<optional>
<ref name="address"/>
</optional>
+ <optional>
+ <ref name="virtioRevision"/>
+ </optional>
</interleave>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3400833..700b2fc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12089,6 +12089,9 @@ virDomainRNGDefParseXML(xmlNodePtr node,
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
goto error;
+ if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+ goto error;
+
cleanup:
VIR_FREE(model);
VIR_FREE(backend);
@@ -21776,6 +21779,8 @@ virDomainRNGDefFormat(virBufferPtr buf,
return -1;
}
+ virDomainVirtioRevisionFormatXML(buf, def->virtio_rev);
+
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</rng>\n");
return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0f116b7..d1c7975 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1946,6 +1946,7 @@ struct _virDomainRNGDef {
} source;
virDomainDeviceInfo info;
+ virBitmapPtr virtio_rev;
};
typedef enum {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 1f9f26f..c3a4654 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -99,5 +99,10 @@
<virtio revision='0.9'/>
<virtio revision='1.0'/>
</memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/random</backend>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x0d' function='0x0'/>
+ <virtio revision='1.0'/>
+ </rng>
</devices>
</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 1f9f26f..c3a4654 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -99,5 +99,10 @@
<virtio revision='0.9'/>
<virtio revision='1.0'/>
</memballoon>
+ <rng model='virtio'>
+ <backend model='random'>/dev/random</backend>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x0d' function='0x0'/>
+ <virtio revision='1.0'/>
+ </rng>
</devices>
</domain>
--
2.7.3