The 'builtin' rng backend model can be used as following:
<rng model='virtio'>
<backend model='builtin'/>
</rng>
Signed-off-by: Han Han <hhan(a)redhat.com>
---
docs/formatdomain.html.in | 10 ++++++++++
docs/formatdomaincaps.html.in | 1 +
docs/schemas/domaincommon.rng | 6 ++++++
src/conf/domain_audit.c | 2 ++
src/conf/domain_conf.c | 9 +++++++++
src/conf/domain_conf.h | 1 +
6 files changed, 29 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 3040448df1..9621b5f120 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8257,6 +8257,8 @@ qemu-kvm -net nic,model=? /dev/null
<source mode='bind' service='1234'/>
<source mode='connect' host='1.2.3.4'
service='1234'/>
</backend>
+ <!-- OR -->
+ <backend model='builtin'/>
</rng>
</devices>
...
@@ -8321,6 +8323,14 @@ qemu-kvm -net nic,model=? /dev/null
for more information.
</p>
</dd>
+ <dt><code>builtin</code></dt>
+ <dd>
+ <p>
+ This backend uses qemu builtin random generator, which uses
+ getrandom() syscall to generate random.
+ (<span class="since">Since 6.0.0 and QEMU
4.2</span>)
+ </p>
+ </dd>
</dl>
</dd>
<dt><code>driver</code></dt>
diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in
index 6bf7a1c17a..aa4dece220 100644
--- a/docs/formatdomaincaps.html.in
+++ b/docs/formatdomaincaps.html.in
@@ -481,6 +481,7 @@
<enum name='backendModel'>
<value>random</value>
<value>egd</value>
+ <value>builtin</value>
</enum>
</rng>
...
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 9b555d6acb..bbcf6ce896 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5681,6 +5681,12 @@
<ref name="qemucdevSrcType"/>
<ref name="qemucdevSrcDef"/>
</group>
+ <group>
+ <attribute name="model">
+ <value>builtin</value>
+ </attribute>
+ <empty/>
+ </group>
</choice>
</element>
</define>
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index fdccc585fb..138f270129 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -227,6 +227,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
newsrcpath = virDomainChrSourceDefGetPath(newDef->source.chardev);
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
}
@@ -242,6 +243,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
oldsrcpath = virDomainChrSourceDefGetPath(oldDef->source.chardev);
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
}
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6b05d06481..dc0c8997bc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1112,6 +1112,7 @@ VIR_ENUM_IMPL(virDomainRNGBackend,
VIR_DOMAIN_RNG_BACKEND_LAST,
"random",
"egd",
+ "builtin",
);
VIR_ENUM_IMPL(virDomainTPMModel,
@@ -14783,6 +14784,7 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
}
@@ -17709,6 +17711,7 @@ virDomainRNGFind(virDomainDefPtr def,
continue;
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
}
@@ -26386,6 +26389,11 @@ virDomainRNGDefFormat(virBufferPtr buf,
return -1;
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</backend>\n");
+ break;
+
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
+ virBufferAddLit(buf, "/>\n");
+ break;
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
@@ -26417,6 +26425,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def)
case VIR_DOMAIN_RNG_BACKEND_EGD:
virObjectUnref(def->source.chardev);
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
case VIR_DOMAIN_RNG_BACKEND_LAST:
break;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e6b06a8eba..17d7ad9229 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2103,6 +2103,7 @@ typedef enum {
typedef enum {
VIR_DOMAIN_RNG_BACKEND_RANDOM,
VIR_DOMAIN_RNG_BACKEND_EGD,
+ VIR_DOMAIN_RNG_BACKEND_BUILTIN,
VIR_DOMAIN_RNG_BACKEND_LAST
} virDomainRNGBackend;
--
2.24.0.rc1