[libvirt] [PATCH v5 01/10] qemu: Convert jobInfo stats into a union
Jiri Denemark
jdenemar at redhat.com
Mon Feb 5 15:07:20 UTC 2018
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 at redhat.com>
...
> 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 at redhat.com>
More information about the libvir-list
mailing list