Re: [PATCH v5 01/10] qemu: Convert jobInfo stats into a union

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 02, 2018 at 17:40:09 -0500, John Ferlan wrote:
> Convert the stats field in _qemuDomainJobInfo to be a union. This
> will allow for the collection of various different types of stats
> in the same field.
> 
> When starting the async job that will end up being used for stats,
> set the @statsType value appropriately. The @mirrorStats are
> special and are used with stats.mig in order to generate the
> returned job stats for a migration.
> 
> Using the NONE should avoid the possibility that some random
> async job would try to return stats for migration even though
> a migration is not in progress.
> 
> For now a migration and a save job will use the same statsType
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
...
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 9789688e1..01d9bf1f6 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
...
> @@ -13227,10 +13231,16 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver,
>      }
>      *jobInfo = *priv->job.current;
>  
> -    if (qemuDomainGetJobInfoMigrationStats(driver, vm, jobInfo) < 0)
> -        goto cleanup;
> +    switch (jobInfo->statsType) {
> +    case QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION:
> +        if (qemuDomainGetJobInfoMigrationStats(driver, vm, jobInfo) < 0)
> +            goto cleanup;
> +        ret = 0;

Hmm, I think this ret = 0 should be moved...
> +        break;
>  
> -    ret = 0;
> +    case QEMU_DOMAIN_JOB_STATS_TYPE_NONE:
> +        break;
> +    }

...here. Otherwise getting job stats for a job which cannot provide any
statistics would report an unknown error instead of at least reporting
the type of a job and for how long it's been running.

With this small fix:

Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux