[libvirt] [PATCH 8/8] test driver: Implement testNodeGetFreePages.

Michal Privoznik mprivozn at redhat.com
Thu Sep 15 13:37:50 UTC 2016


On 15.09.2016 10:27, Tomáš Ryšavý wrote:
> Signed-off-by: Tomáš Ryšavý <tom.rysavy.0 at gmail.com>
> ---
>  src/test/test_driver.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 7c64dcd..cbebc75 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -2795,6 +2795,30 @@ testNodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED)
>      return ret;
>  }
>  
> +static int
> +testNodeGetFreePages(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                     unsigned int npages,
> +                     unsigned int *pages ATTRIBUTE_UNUSED,
> +                     int startCell ATTRIBUTE_UNUSED,
> +                     unsigned int cellCount,
> +                     unsigned long long *counts,
> +                     unsigned int flags)
> +{
> +    size_t i = 0, j = 0;
> +    int x = 6;
> +
> +    virCheckFlags(0, -1);
> +
> +    for (i = 0; i < cellCount; i++) {
> +        for (j = 0; j < npages; j++) {
> +            x = x * 2 + 7;
> +            counts[(i * npages) +  j] = x;
> +        }
> +    }
> +

Okay, this will work for now, but in future we should record the free
pages in test driver struct and expose that correctly in capabilities
XML, support alloc pages, and so on.

Michal





More information about the libvir-list mailing list