From: Ján Tomko Date: Mon, 6 Jun 2016 15:01:56 +0000 (+0200) Subject: Add virtio-related options to rng devices X-Git-Tag: v3.5.0-rc1~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f65db1be1200b656094180ecfdb63f8bd0158cab;p=thirdparty%2Flibvirt.git Add virtio-related options to rng devices https://bugzilla.redhat.com/show_bug.cgi?id=1283251 Reviewed-by: Pavel Hrdina --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index efd7a5fcc2..fd2195a67f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7064,6 +7064,17 @@ qemu-kvm -net nic,model=? /dev/null +
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 8ff553d3fd..c7a0867497 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4965,6 +4965,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9c71c8a396..c6f5d93909 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12949,6 +12949,9 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlopt, if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) goto error; + if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0) + goto error; + cleanup: VIR_FREE(model); VIR_FREE(backend); @@ -19663,6 +19666,10 @@ virDomainRNGDefCheckABIStability(virDomainRNGDefPtr src, return false; } + if (src->virtio && dst->virtio && + !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + return false; + if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) return false; @@ -23176,6 +23183,7 @@ virDomainRNGDefFormat(virBufferPtr buf, { const char *model = virDomainRNGModelTypeToString(def->model); const char *backend = virDomainRNGBackendTypeToString(def->backend); + virBuffer driverBuf = VIR_BUFFER_INITIALIZER; virBufferAsprintf(buf, "\n", model); virBufferAdjustIndent(buf, 2); @@ -23204,6 +23212,16 @@ virDomainRNGDefFormat(virBufferPtr buf, break; } + virDomainVirtioOptionsFormat(&driverBuf, def->virtio); + if (virBufferCheckError(&driverBuf) < 0) + return -1; + + if (virBufferUse(&driverBuf)) { + virBufferAddLit(buf, "\n"); + } + if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) { if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) return -1; @@ -23232,6 +23250,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def) } virDomainDeviceInfoClear(&def->info); + VIR_FREE(def->virtio); VIR_FREE(def); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index acb6748f7b..40258743d7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2020,6 +2020,7 @@ struct _virDomainRNGDef { } source; virDomainDeviceInfo info; + virDomainVirtioOptionsPtr virtio; }; typedef enum { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml index 33da214611..b7b95014cd 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml @@ -80,6 +80,7 @@ /dev/random +