From b452148f1570656d9b42efbdbff396cf5cafa9c7 Mon Sep 17 00:00:00 2001 Message-Id: From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 9 Jun 2017 12:49:05 +0200 Subject: [PATCH] Add virtio-related options to rng devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugzilla.redhat.com/show_bug.cgi?id=1283251 Reviewed-by: Pavel Hrdina (cherry picked from commit f65db1be1200b656094180ecfdb63f8bd0158cab) Signed-off-by: Ján Tomko Signed-off-by: Jiri Denemark --- docs/formatdomain.html.in | 11 +++++++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 19 +++++++++++++++++++ src/conf/domain_conf.h | 1 + .../qemuxml2argvdata/qemuxml2argv-virtio-options.xml | 1 + 5 files changed, 37 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8d3f916a19..2e5c669c4a 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7061,6 +7061,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 5e526b6100..7e80275029 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4912,6 +4912,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c7ffc0419..059c006b69 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12922,6 +12922,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); @@ -19637,6 +19640,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; @@ -23132,6 +23139,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); @@ -23160,6 +23168,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; @@ -23188,6 +23206,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 fdd852c29d..8cb9d5d0b1 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 +
-- 2.13.1