<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<virtio revision='1'/>
</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 6c8ea15..bc9a3db 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6502,6 +6502,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</code> and <code>1</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 05351a0..dbaa1d7 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4750,6 +4750,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 bb91b0c..9f1f20f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12046,6 +12046,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);
@@ -21690,6 +21693,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 880930f..9c806a4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1942,6 +1942,7 @@ struct _virDomainRNGDef {
} source;
virDomainDeviceInfo info;
+ virDomainVirtioRevision virtio_rev;
};
typedef enum {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index 2e13808..94c844e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -98,5 +98,10 @@
<address type='pci' domain='0x0000' bus='0x00'
slot='0x0c' function='0x0'/>
<virtio revision='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'/>
+ </rng>
</devices>
</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index 2e13808..94c844e 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -98,5 +98,10 @@
<address type='pci' domain='0x0000' bus='0x00'
slot='0x0c' function='0x0'/>
<virtio revision='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'/>
+ </rng>
</devices>
</domain>
--
2.7.3