Re: [PATCH 9/9] qemu: Implement VIR_DOMAIN_BANDWIDTH_IN_FLOOR

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

 




On 08/03/2015 02:39 AM, Michal Privoznik wrote:
> Well, there are just two places that needs adjustment:
> 
> qemuDomainGetInterfaceParameters - to report the @floor
> qemuDomainSetInterfaceParameters - now that the function has been
> fixed, we can allow updating @floor too.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 171b58f..7123083 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -138,7 +138,7 @@ VIR_LOG_INIT("qemu.qemu_driver");
>  
>  #define QEMU_NB_BLKIO_PARAM  6
>  
> -#define QEMU_NB_BANDWIDTH_PARAM 6
> +#define QEMU_NB_BANDWIDTH_PARAM 7
>  
>  static void processWatchdogEvent(virQEMUDriverPtr driver,
>                                   virDomainObjPtr vm,
> @@ -11126,6 +11126,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
>                                 VIR_TYPED_PARAM_UINT,
>                                 VIR_DOMAIN_BANDWIDTH_IN_BURST,
>                                 VIR_TYPED_PARAM_UINT,
> +                               VIR_DOMAIN_BANDWIDTH_IN_FLOOR,
> +                               VIR_TYPED_PARAM_UINT,
>                                 VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE,
>                                 VIR_TYPED_PARAM_UINT,
>                                 VIR_DOMAIN_BANDWIDTH_OUT_PEAK,
> @@ -11178,6 +11180,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
>              bandwidth->in->peak = params[i].value.ui;
>          } else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_IN_BURST)) {
>              bandwidth->in->burst = params[i].value.ui;
> +        } else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_IN_FLOOR)) {
> +            bandwidth->in->floor = params[i].value.ui;
> +            inboundSpecified = true;

If 'average' is required, then can one really provide just floor?

>          } else if (STREQ(param->field, VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE)) {
>              bandwidth->out->average = params[i].value.ui;
>              outboundSpecified = true;
> @@ -11191,7 +11196,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
>      /* average is mandatory, peak and burst are optional. So if no
>       * average is given, we free inbound/outbound here which causes
>       * inbound/outbound to not be set. */

Adjust comment to account for floor...

> -    if (!bandwidth->in->average)
> +    if (!bandwidth->in->average && !bandwidth->in->floor)

Again, I thought average was required ... sorry it's just late. Maybe
the updated comment will answer my query...

ACK in principle

John
>          VIR_FREE(bandwidth->in);
>      if (!bandwidth->out->average)
>          VIR_FREE(bandwidth->out);
> @@ -11355,7 +11360,15 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
>              if (net->bandwidth && net->bandwidth->in)
>                  params[i].value.ui = net->bandwidth->in->burst;
>              break;
> -        case 3: /* outbound.average */
> +        case 3: /* inbound.floor */
> +            if (virTypedParameterAssign(&params[i],
> +                                        VIR_DOMAIN_BANDWIDTH_IN_FLOOR,
> +                                        VIR_TYPED_PARAM_UINT, 0) < 0)
> +                goto cleanup;
> +            if (net->bandwidth && net->bandwidth->in)
> +                params[i].value.ui = net->bandwidth->in->floor;
> +            break;
> +        case 4: /* outbound.average */
>              if (virTypedParameterAssign(&params[i],
>                                          VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE,
>                                          VIR_TYPED_PARAM_UINT, 0) < 0)
> @@ -11363,7 +11376,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
>              if (net->bandwidth && net->bandwidth->out)
>                  params[i].value.ui = net->bandwidth->out->average;
>              break;
> -        case 4: /* outbound.peak */
> +        case 5: /* outbound.peak */
>              if (virTypedParameterAssign(&params[i],
>                                          VIR_DOMAIN_BANDWIDTH_OUT_PEAK,
>                                          VIR_TYPED_PARAM_UINT, 0) < 0)
> @@ -11371,7 +11384,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
>              if (net->bandwidth && net->bandwidth->out)
>                  params[i].value.ui = net->bandwidth->out->peak;
>              break;
> -        case 5: /* outbound.burst */
> +        case 6: /* outbound.burst */
>              if (virTypedParameterAssign(&params[i],
>                                          VIR_DOMAIN_BANDWIDTH_OUT_BURST,
>                                          VIR_TYPED_PARAM_UINT, 0) < 0)
> 

--
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]