diff mbox series

[2/7] qemu: capabilities: fill in domcaps <rng>

Message ID 13488456c6173b3d69b870a747372a2a6d5e3e6e.1554419814.git.crobinso@redhat.com
State New
Headers show
Series qemu: use domCaps for validation | expand

Commit Message

Cole Robinson April 4, 2019, 11:37 p.m. UTC
The model logic is taken from qemuDomainRNGDefValidate

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/qemu/qemu_capabilities.c                  | 30 +++++++++++++++++++
 .../qemu_1.7.0.x86_64.xml                     |  9 ++++++
 .../qemu_2.12.0-virt.aarch64.xml              | 11 +++++++
 .../qemu_2.12.0.ppc64.xml                     | 11 +++++++
 .../qemu_2.12.0.s390x.xml                     | 11 +++++++
 .../qemu_2.12.0.x86_64.xml                    | 11 +++++++
 .../qemu_2.6.0-virt.aarch64.xml               | 11 +++++++
 .../qemu_2.6.0.aarch64.xml                    | 11 +++++++
 .../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 11 +++++++
 .../qemu_2.6.0.x86_64.xml                     | 11 +++++++
 .../domaincapsschemadata/qemu_2.7.0.s390x.xml | 11 +++++++
 .../qemu_2.8.0-tcg.x86_64.xml                 | 11 +++++++
 .../domaincapsschemadata/qemu_2.8.0.s390x.xml | 11 +++++++
 .../qemu_2.8.0.x86_64.xml                     | 11 +++++++
 .../qemu_2.9.0-q35.x86_64.xml                 | 11 +++++++
 .../qemu_2.9.0-tcg.x86_64.xml                 | 11 +++++++
 .../qemu_2.9.0.x86_64.xml                     | 11 +++++++
 .../domaincapsschemadata/qemu_3.0.0.s390x.xml | 11 +++++++
 .../qemu_4.0.0.x86_64.xml                     | 11 +++++++
 19 files changed, 226 insertions(+)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Daniel Henrique Barboza April 26, 2019, 9:49 p.m. UTC | #1
Running make check on the patch series, using the current
master branch, I got the following error:

TEST: domaincapstest
       ..................!.                     20  FAIL
FAIL domaincapstest (exit status: 255)


Running it manually:

In 
'/home/danielhb/kvm-project/libvirt/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml':
Offset 5119
Expect [<]
Actual [  <rng supported='yes'>
       <enum name='model'>
         <value>virtio</value>
         <value>virtio-transitional</value>
         <value>virtio-non-transitional</value>
       </enum>
       <enum name='backendModel'>
         <value>random</value>
         <value>egd</value>
       </enum>
     </rng>
   <]
                                                                      
... FAILED


I believe that you'll need to update the file qemu_3.1.0.x86_64.xml
as well.



DHB


On 4/4/19 8:37 PM, Cole Robinson wrote:
> The model logic is taken from qemuDomainRNGDefValidate

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>   src/qemu/qemu_capabilities.c                  | 30 +++++++++++++++++++

>   .../qemu_1.7.0.x86_64.xml                     |  9 ++++++

>   .../qemu_2.12.0-virt.aarch64.xml              | 11 +++++++

>   .../qemu_2.12.0.ppc64.xml                     | 11 +++++++

>   .../qemu_2.12.0.s390x.xml                     | 11 +++++++

>   .../qemu_2.12.0.x86_64.xml                    | 11 +++++++

>   .../qemu_2.6.0-virt.aarch64.xml               | 11 +++++++

>   .../qemu_2.6.0.aarch64.xml                    | 11 +++++++

>   .../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 11 +++++++

>   .../qemu_2.6.0.x86_64.xml                     | 11 +++++++

>   .../domaincapsschemadata/qemu_2.7.0.s390x.xml | 11 +++++++

>   .../qemu_2.8.0-tcg.x86_64.xml                 | 11 +++++++

>   .../domaincapsschemadata/qemu_2.8.0.s390x.xml | 11 +++++++

>   .../qemu_2.8.0.x86_64.xml                     | 11 +++++++

>   .../qemu_2.9.0-q35.x86_64.xml                 | 11 +++++++

>   .../qemu_2.9.0-tcg.x86_64.xml                 | 11 +++++++

>   .../qemu_2.9.0.x86_64.xml                     | 11 +++++++

>   .../domaincapsschemadata/qemu_3.0.0.s390x.xml | 11 +++++++

>   .../qemu_4.0.0.x86_64.xml                     | 11 +++++++

>   19 files changed, 226 insertions(+)

>

> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c

> index 71d4c01296..46ba5e30b5 100644

> --- a/src/qemu/qemu_capabilities.c

> +++ b/src/qemu/qemu_capabilities.c

> @@ -5165,6 +5165,34 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,

>   }

>   

>   

> +static int

> +virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps,

> +                                   virDomainCapsDeviceRNGPtr rng)

> +{

> +    rng->supported = VIR_TRISTATE_BOOL_YES;

> +    rng->model.report = true;

> +    rng->backendModel.report = true;

> +

> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {

> +        VIR_DOMAIN_CAPS_ENUM_SET(rng->model, VIR_DOMAIN_RNG_MODEL_VIRTIO);

> +

> +        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL) ||

> +            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {

> +            VIR_DOMAIN_CAPS_ENUM_SET(rng->model,

> +                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,

> +                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL);

> +        }

> +    }

> +

> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_EGD))

> +        VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_EGD);

> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM))

> +        VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM);

> +

> +    return 0;

> +}

> +

> +

>   /**

>    * virQEMUCapsSupportsGICVersion:

>    * @qemuCaps: QEMU capabilities

> @@ -5306,6 +5334,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,

>       virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;

>       virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;

>       virDomainCapsDeviceVideoPtr video = &domCaps->video;

> +    virDomainCapsDeviceRNGPtr rng = &domCaps->rng;

>   

>       domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,

>                                                        domCaps->machine);

> @@ -5332,6 +5361,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,

>           virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||

>           virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 ||

>           virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||

> +        virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) < 0 ||

>           virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0 ||

>           virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) < 0)

>           return -1;

> diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml

> index 497363bbe9..a9b0efdbdb 100644

> --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml

> @@ -109,6 +109,15 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml

> index 7639df44c6..654ce1f538 100644

> --- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml

> @@ -114,6 +114,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='yes'>

> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml

> index f10d361359..2ac32fcb3b 100644

> --- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml

> @@ -80,6 +80,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml

> index 41a81ff02f..fa377d33a0 100644

> --- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml

> +++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml

> @@ -172,6 +172,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml

> index 5913e7fc63..712b83f443 100644

> --- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml

> @@ -142,6 +142,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml

> index 9ee801092e..26bd16788a 100644

> --- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml

> @@ -111,6 +111,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='yes'>

> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml

> index 4dd0b52ed3..3aa5474e64 100644

> --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml

> @@ -111,6 +111,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml

> index aa982d237e..cb179b34af 100644

> --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml

> @@ -84,6 +84,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml

> index 6aa3f52ee4..5a675e205f 100644

> --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml

> @@ -116,6 +116,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml

> index 8daa15ab9d..f601922d5e 100644

> --- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml

> +++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml

> @@ -77,6 +77,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml

> index 081805aa4a..4d48e7d251 100644

> --- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml

> @@ -117,6 +117,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml

> index 62c51e4087..f18dc262b4 100644

> --- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml

> +++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml

> @@ -158,6 +158,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml

> index 1bb034aa4f..46d398949a 100644

> --- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml

> @@ -117,6 +117,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml

> index 67c6d5e77e..a7392c0929 100644

> --- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml

> @@ -125,6 +125,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml

> index 588ef08199..f94f805b81 100644

> --- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml

> @@ -149,6 +149,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml

> index 598937a971..b0039c8246 100644

> --- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml

> @@ -126,6 +126,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml

> index 1d97f1f344..b33ff6a09d 100644

> --- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml

> +++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml

> @@ -178,6 +178,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>

> diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml

> index df66be9e29..7596e414d6 100644

> --- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml

> +++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml

> @@ -143,6 +143,17 @@

>           <value>vfio</value>

>         </enum>

>       </hostdev>

> +    <rng supported='yes'>

> +      <enum name='model'>

> +        <value>virtio</value>

> +        <value>virtio-transitional</value>

> +        <value>virtio-non-transitional</value>

> +      </enum>

> +      <enum name='backendModel'>

> +        <value>random</value>

> +        <value>egd</value>

> +      </enum>

> +    </rng>

>     </devices>

>     <features>

>       <gic supported='no'/>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font size="+1">Running make check on the patch series, using the
      current<br>
      master branch, I got the following error: <br>
      <br>
      TEST: domaincapstest<br>
            ..................!.                     20  FAIL<br>
      FAIL domaincapstest (exit status: 255)<br>
      <br>
      <br>
      Running it manually:<br>
      <br>
      In
'/home/danielhb/kvm-project/libvirt/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml':<br>
      Offset 5119<br>
      Expect [&lt;]<br>
      Actual [  &lt;rng supported='yes'&gt;<br>
            &lt;enum name='model'&gt;<br>
              &lt;value&gt;virtio&lt;/value&gt;<br>
              &lt;value&gt;virtio-transitional&lt;/value&gt;<br>
              &lt;value&gt;virtio-non-transitional&lt;/value&gt;<br>
            &lt;/enum&gt;<br>
            &lt;enum name='backendModel'&gt;<br>
              &lt;value&gt;random&lt;/value&gt;<br>
              &lt;value&gt;egd&lt;/value&gt;<br>
            &lt;/enum&gt;<br>
          &lt;/rng&gt;<br>
        &lt;]<br>
                                                                     ...
      FAILED<br>
      <br>
      <br>
      I believe that you'll need to update the file </font><font
      size="+1"><font size="+1">qemu_3.1.0.x86_64.xml</font><br>
      as well.<br>
      <br>
      <br>
      <br>
      DHB<br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 4/4/19 8:37 PM, Cole Robinson wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:13488456c6173b3d69b870a747372a2a6d5e3e6e.1554419814.git.crobinso@redhat.com">
      <pre class="moz-quote-pre" wrap="">The model logic is taken from qemuDomainRNGDefValidate

Signed-off-by: Cole Robinson <a class="moz-txt-link-rfc2396E" href="mailto:crobinso@redhat.com">&lt;crobinso@redhat.com&gt;</a>

---
 src/qemu/qemu_capabilities.c                  | 30 +++++++++++++++++++
 .../qemu_1.7.0.x86_64.xml                     |  9 ++++++
 .../qemu_2.12.0-virt.aarch64.xml              | 11 +++++++
 .../qemu_2.12.0.ppc64.xml                     | 11 +++++++
 .../qemu_2.12.0.s390x.xml                     | 11 +++++++
 .../qemu_2.12.0.x86_64.xml                    | 11 +++++++
 .../qemu_2.6.0-virt.aarch64.xml               | 11 +++++++
 .../qemu_2.6.0.aarch64.xml                    | 11 +++++++
 .../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 11 +++++++
 .../qemu_2.6.0.x86_64.xml                     | 11 +++++++
 .../domaincapsschemadata/qemu_2.7.0.s390x.xml | 11 +++++++
 .../qemu_2.8.0-tcg.x86_64.xml                 | 11 +++++++
 .../domaincapsschemadata/qemu_2.8.0.s390x.xml | 11 +++++++
 .../qemu_2.8.0.x86_64.xml                     | 11 +++++++
 .../qemu_2.9.0-q35.x86_64.xml                 | 11 +++++++
 .../qemu_2.9.0-tcg.x86_64.xml                 | 11 +++++++
 .../qemu_2.9.0.x86_64.xml                     | 11 +++++++
 .../domaincapsschemadata/qemu_3.0.0.s390x.xml | 11 +++++++
 .../qemu_4.0.0.x86_64.xml                     | 11 +++++++
 19 files changed, 226 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 71d4c01296..46ba5e30b5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5165,6 +5165,34 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
 }
 
 
+static int
+virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps,
+                                   virDomainCapsDeviceRNGPtr rng)
+{
+    rng-&gt;supported = VIR_TRISTATE_BOOL_YES;
+    rng-&gt;model.report = true;
+    rng-&gt;backendModel.report = true;
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
+        VIR_DOMAIN_CAPS_ENUM_SET(rng-&gt;model, VIR_DOMAIN_RNG_MODEL_VIRTIO);
+
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL) ||
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
+            VIR_DOMAIN_CAPS_ENUM_SET(rng-&gt;model,
+                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL);
+        }
+    }
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_EGD))
+        VIR_DOMAIN_CAPS_ENUM_SET(rng-&gt;backendModel, VIR_DOMAIN_RNG_BACKEND_EGD);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM))
+        VIR_DOMAIN_CAPS_ENUM_SET(rng-&gt;backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM);
+
+    return 0;
+}
+
+
 /**
  * virQEMUCapsSupportsGICVersion:
  * @qemuCaps: QEMU capabilities
@@ -5306,6 +5334,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,
     virDomainCapsDeviceHostdevPtr hostdev = &amp;domCaps-&gt;hostdev;
     virDomainCapsDeviceGraphicsPtr graphics = &amp;domCaps-&gt;graphics;
     virDomainCapsDeviceVideoPtr video = &amp;domCaps-&gt;video;
+    virDomainCapsDeviceRNGPtr rng = &amp;domCaps-&gt;rng;
 
     domCaps-&gt;maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,
                                                      domCaps-&gt;machine);
@@ -5332,6 +5361,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps,
         virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) &lt; 0 ||
         virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) &lt; 0 ||
         virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) &lt; 0 ||
+        virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) &lt; 0 ||
         virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) &lt; 0 ||
         virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) &lt; 0)
         return -1;
diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
index 497363bbe9..a9b0efdbdb 100644
--- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
@@ -109,6 +109,15 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
index 7639df44c6..654ce1f538 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
@@ -114,6 +114,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='yes'&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
index f10d361359..2ac32fcb3b 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
@@ -80,6 +80,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
index 41a81ff02f..fa377d33a0 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
@@ -172,6 +172,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
index 5913e7fc63..712b83f443 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
@@ -142,6 +142,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
index 9ee801092e..26bd16788a 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
@@ -111,6 +111,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='yes'&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
index 4dd0b52ed3..3aa5474e64 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
@@ -111,6 +111,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
index aa982d237e..cb179b34af 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
@@ -84,6 +84,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
index 6aa3f52ee4..5a675e205f 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
@@ -116,6 +116,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
index 8daa15ab9d..f601922d5e 100644
--- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
@@ -77,6 +77,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
index 081805aa4a..4d48e7d251 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
@@ -117,6 +117,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
index 62c51e4087..f18dc262b4 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
@@ -158,6 +158,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
index 1bb034aa4f..46d398949a 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
@@ -117,6 +117,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
index 67c6d5e77e..a7392c0929 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
@@ -125,6 +125,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
index 588ef08199..f94f805b81 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
@@ -149,6 +149,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
index 598937a971..b0039c8246 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
@@ -126,6 +126,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
index 1d97f1f344..b33ff6a09d 100644
--- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
@@ -178,6 +178,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
index df66be9e29..7596e414d6 100644
--- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
@@ -143,6 +143,17 @@
         &lt;value&gt;vfio&lt;/value&gt;
       &lt;/enum&gt;
     &lt;/hostdev&gt;
+    &lt;rng supported='yes'&gt;
+      &lt;enum name='model'&gt;
+        &lt;value&gt;virtio&lt;/value&gt;
+        &lt;value&gt;virtio-transitional&lt;/value&gt;
+        &lt;value&gt;virtio-non-transitional&lt;/value&gt;
+      &lt;/enum&gt;
+      &lt;enum name='backendModel'&gt;
+        &lt;value&gt;random&lt;/value&gt;
+        &lt;value&gt;egd&lt;/value&gt;
+      &lt;/enum&gt;
+    &lt;/rng&gt;
   &lt;/devices&gt;
   &lt;features&gt;
     &lt;gic supported='no'/&gt;
</pre>
    </blockquote>
    <br>
  </body>
</html>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 71d4c01296..46ba5e30b5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5165,6 +5165,34 @@  virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
 }
 
 
+static int
+virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps,
+                                   virDomainCapsDeviceRNGPtr rng)
+{
+    rng->supported = VIR_TRISTATE_BOOL_YES;
+    rng->model.report = true;
+    rng->backendModel.report = true;
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
+        VIR_DOMAIN_CAPS_ENUM_SET(rng->model, VIR_DOMAIN_RNG_MODEL_VIRTIO);
+
+        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL) ||
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
+            VIR_DOMAIN_CAPS_ENUM_SET(rng->model,
+                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+                                     VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL);
+        }
+    }
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_EGD))
+        VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_EGD);
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM))
+        VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM);
+
+    return 0;
+}
+
+
 /**
  * virQEMUCapsSupportsGICVersion:
  * @qemuCaps: QEMU capabilities
@@ -5306,6 +5334,7 @@  virQEMUCapsFillDomainCaps(virCapsPtr caps,
     virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
     virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
     virDomainCapsDeviceVideoPtr video = &domCaps->video;
+    virDomainCapsDeviceRNGPtr rng = &domCaps->rng;
 
     domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,
                                                      domCaps->machine);
@@ -5332,6 +5361,7 @@  virQEMUCapsFillDomainCaps(virCapsPtr caps,
         virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||
         virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 ||
         virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||
+        virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) < 0 ||
         virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0 ||
         virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) < 0)
         return -1;
diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
index 497363bbe9..a9b0efdbdb 100644
--- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml
@@ -109,6 +109,15 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
index 7639df44c6..654ce1f538 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml
@@ -114,6 +114,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='yes'>
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
index f10d361359..2ac32fcb3b 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml
@@ -80,6 +80,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
index 41a81ff02f..fa377d33a0 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml
@@ -172,6 +172,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
index 5913e7fc63..712b83f443 100644
--- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml
@@ -142,6 +142,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
index 9ee801092e..26bd16788a 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml
@@ -111,6 +111,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='yes'>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
index 4dd0b52ed3..3aa5474e64 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml
@@ -111,6 +111,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
index aa982d237e..cb179b34af 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml
@@ -84,6 +84,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
index 6aa3f52ee4..5a675e205f 100644
--- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml
@@ -116,6 +116,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
index 8daa15ab9d..f601922d5e 100644
--- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml
@@ -77,6 +77,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
index 081805aa4a..4d48e7d251 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml
@@ -117,6 +117,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
index 62c51e4087..f18dc262b4 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml
@@ -158,6 +158,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
index 1bb034aa4f..46d398949a 100644
--- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml
@@ -117,6 +117,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
index 67c6d5e77e..a7392c0929 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml
@@ -125,6 +125,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
index 588ef08199..f94f805b81 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml
@@ -149,6 +149,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
index 598937a971..b0039c8246 100644
--- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml
@@ -126,6 +126,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
index 1d97f1f344..b33ff6a09d 100644
--- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
+++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml
@@ -178,6 +178,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>
diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
index df66be9e29..7596e414d6 100644
--- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
+++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
@@ -143,6 +143,17 @@ 
         <value>vfio</value>
       </enum>
     </hostdev>
+    <rng supported='yes'>
+      <enum name='model'>
+        <value>virtio</value>
+        <value>virtio-transitional</value>
+        <value>virtio-non-transitional</value>
+      </enum>
+      <enum name='backendModel'>
+        <value>random</value>
+        <value>egd</value>
+      </enum>
+    </rng>
   </devices>
   <features>
     <gic supported='no'/>