Re: [PATCH v3 2/7] qemu_driver: Probe capability before calculating dirty page rate

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

 



On 1/28/22 08:35, huangy81@xxxxxxxxxxxxxxx wrote:
> From: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx>
> 
> Probing QEMU_CAPS_CALC_DIRTY_RATE capability in advance
> in case of failure when calculating dirty page rate.
> 
> Signed-off-by: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0a1ba74..c8ee897 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -20679,6 +20679,12 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom,
>      VIR_DEBUG("Calculate dirty rate in next %d seconds", seconds);
>  
>      priv = vm->privateData;
> +    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CALC_DIRTY_RATE)) {
> +        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> +                       _("QEMU does not support calculating dirty page rate"));
> +        goto endjob;
> +    }
> +
>      qemuDomainObjEnterMonitor(driver, vm);
>      ret = qemuMonitorStartDirtyRateCalc(priv->mon, seconds);
>  

This can be done before BeginJob(); because acquiring a job is needless
(and possibly blocking) operation if we know upfront that QEMU doesn't
support what we need. Moving 'priv = vm->privateData' line is perfectly
okay.

Michal




[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