[libvirt PATCH] qemu_driver: increase recorded counter for disk block stats

Michal Privoznik mprivozn at redhat.com
Thu Feb 4 12:04:28 UTC 2021


On 2/3/21 7:10 PM, Pavel Hrdina wrote:
> Commit <318d807a0bd3372b634d1952b559c5c627ccfa5b> added a fix to skip
> most of the block stat code to not log error message for missing storage
> sources but forgot to increase the recordnr counter.
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>   src/qemu/qemu_driver.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 69fcd28666..c34af6b7d1 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18414,8 +18414,14 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDefPtr disk,
>           VIR_INFO("optional disk '%s' source file is missing, "
>                    "skip getting stats", disk->dst);
>   
> -        return qemuDomainGetStatsBlockExportHeader(disk, disk->src, *recordnr,
> -                                                   params);
> +        if (qemuDomainGetStatsBlockExportHeader(disk, disk->src, *recordnr,
> +                                                params) < 0) {
> +            return -1;
> +        }
> +
> +        (*recordnr)++;
> +
> +        return 0;
>       }
>   
>       /* vhost-user disk doesn't support getting block stats */
> 

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Although now we have two if()-s with the exact same body. At your 
discretion, join them together.

Michal




More information about the libvir-list mailing list