[libvirt] [PATCH 7/8] test: Refactor testDomainSetVcpusFlags

Ján Tomko jtomko at redhat.com
Fri Jun 19 14:56:05 UTC 2015


On Tue, Jun 16, 2015 at 07:43:19PM +0200, Peter Krempa wrote:
> Remove the bogous flag check and refactor the code by using

s/bogous/bogus

> virDomainObjGetDefs instead of virDomainObjGetPersistentDef.
> ---
>  src/test/test_driver.c | 68 +++++++++++++++++---------------------------------
>  1 file changed, 23 insertions(+), 45 deletions(-)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 59e2031..cfec122 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c

> 
> -    if (nrCpus > maxvcpus) {
> +    if ((def &&
> +         def->maxvcpus < nrCpus) ||
> +        (persistentDef &&
> +         !(flags & VIR_DOMAIN_VCPU_MAXIMUM) &&
> +         persistentDef->maxvcpus < nrCpus)) {
>          virReportError(VIR_ERR_INVALID_ARG,
>                         _("requested cpu amount exceeds maximum (%d > %d)"),
>                         nrCpus, maxvcpus);

The comparison uses {persistentD,d}ef->maxvcpus, but the error message
shows maxvcpus.

>          goto cleanup;
>      }
> 
> -    if (!(persistentDef = virDomainObjGetPersistentDef(privconn->caps,
> -                                                       privconn->xmlopt,
> -                                                       privdom)))
> +    if (def &&
> +        testDomainUpdateVCPUs(privconn, privdom, nrCpus, 0) < 0)
>          goto cleanup;
> 

ACK with those fixes.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150619/0eac1fcc/attachment-0001.sig>


More information about the libvir-list mailing list