[libvirt] [PATCHv5 10/13] Add compatibility attribute to rng devices
Peter Krempa
pkrempa at redhat.com
Wed Sep 7 13:47:52 UTC 2016
On Wed, Aug 24, 2016 at 00:20:52 +0200, Ján Tomko wrote:
> <rng model='virtio'>
> <driver compatibility='modern'/>
> <backend model='random'>/dev/random</backend>
> </rng>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1227354
> ---
> docs/formatdomain.html.in | 7 +++++++
> docs/schemas/domaincommon.rng | 5 +++++
> src/conf/domain_conf.c | 8 ++++++++
> src/conf/domain_conf.h | 1 +
> tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml | 5 +++++
> tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml | 4 ++++
> 6 files changed, 30 insertions(+)
>
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index fa7e2bb..41a9325 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -6532,6 +6532,13 @@ qemu-kvm -net nic,model=? /dev/null
> </dd>
> </dl>
> </dd>
> + <dt><code>driver</code></dt>
> + <dd>
> + The <code>compatibility</code> attribute of the <code>driver</code>
> + element can be used to specify the compatibility of virtio devices.
> + Allowed values are <code>legacy</code>, <code>transitional</code>
> + and <code>modern</code>. <span class="since">Since 2.2.0</span>.
> + </dd>
>
> </dl>
>
Same as above.
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 885430d..166f5fb 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -12044,6 +12044,9 @@ virDomainRNGDefParseXML(xmlNodePtr node,
> if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
> goto error;
>
> + if (virDomainDriverCompatibilityParseXML(ctxt, &def->compatibility) < 0)
> + goto error;
> +
> cleanup:
> VIR_FREE(model);
> VIR_FREE(backend);
> @@ -21749,6 +21752,11 @@ virDomainRNGDefFormat(virBufferPtr buf,
> break;
> }
>
> + if (def->compatibility) {
> + virBufferAsprintf(buf, "<driver compatibility='%s'/>",
Missing newline, see test output ...
> + virDomainDriverCompatibilityTypeToString(def->compatibility));
> + }
> +
> if (virDomainDeviceInfoNeedsFormat(&def->info, flags)) {
> if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
> return -1;
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index e7c0ba2..342218e 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1947,6 +1947,7 @@ struct _virDomainRNGDef {
> } source;
>
> virDomainDeviceInfo info;
> + virDomainDriverCompatibility compatibility;
> };
>
> typedef enum {
[...]
> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
> index 02b5598..ab69bb7 100644
> --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
> +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
> @@ -95,5 +95,9 @@
> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
> <driver compatibility='transitional'/>
> </memballoon>
> + <rng model='virtio'>
> + <backend model='random'>/dev/random</backend>
> + <driver compatibility='modern'/><address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
^^ VIR_TEST_REGENERATE_OUTPUT is not your friend sometimes ;) (been
there, done that)
> + </rng>
> </devices>
> </domain>
ACK .. similar to previous cases
More information about the libvir-list
mailing list