[libvirt] [PATCH] test_driver: implement virDomainGetDiskErrors
Michal Privoznik
mprivozn at redhat.com
Thu May 9 14:36:22 UTC 2019
On 5/7/19 10:23 PM, Ilias Stamatis wrote:
> Return the number of disks present in the configuration of the fake
> driver when called with @errors as NULL and @maxerrors as 0.
>
> Otherwise return 0 as the number of errors encountered.
>
> Signed-off-by: Ilias Stamatis <stamatis.iliass at gmail.com>
> ---
> src/test/test_driver.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 460c896ef6..5fa9ab30f1 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -3046,6 +3046,32 @@ static int testDomainSetAutostart(virDomainPtr domain,
> return 0;
> }
>
> +static int testDomainGetDiskErrors(virDomainPtr dom,
> + virDomainDiskErrorPtr errors,
> + unsigned int maxerrors ATTRIBUTE_UNUSED,
> + unsigned int flags)
> +{
> + int ret = -1;
> + virDomainObjPtr vm = NULL;
> +
> + virCheckFlags(0, -1);
> +
> + if (!(vm = testDomObjFromDomain(dom)))
> + goto cleanup;
> +
> + if (virDomainObjCheckActive(vm) < 0)
> + goto cleanup;
> +
> + if (!errors)
> + ret = vm->def->ndisks;
> + else
> + ret = 0;
Don't we want to actually set some errors? That might be more helpful
because mgmt app can actually test if it reports disk errors properly.
Michal
More information about the libvir-list
mailing list