Re: [PATCH] implement virDomainSetInterfaceParameters

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

 



On Wed, Jul 24, 2019 at 1:04 PM Erik Skultety <eskultet@xxxxxxxxxx> wrote:
>
> On Sat, Jul 06, 2019 at 01:24:22PM +0200, Ilias Stamatis wrote:
> > Signed-off-by: Ilias Stamatis <stamatis.iliass@xxxxxxxxx>
> > ---
> ...
>
> > +
> > +    /* average or floor are mandatory, peak and burst are optional */
> > +    if (!bandwidth->in->average && !bandwidth->in->floor)
> > +        VIR_FREE(bandwidth->in);
> > +    if (!bandwidth->out->average)
> > +        VIR_FREE(bandwidth->out);
> > +
> > +    if (!net->bandwidth) {
> > +        VIR_STEAL_PTR(net->bandwidth, bandwidth);
> > +    } else {
> > +        if (bandwidth->in) {
> > +            VIR_FREE(net->bandwidth->in);
> > +            VIR_STEAL_PTR(net->bandwidth->in, bandwidth->in);
> > +        }
> > +        if (bandwidth->out) {
> > +            VIR_FREE(net->bandwidth->out);
> > +            VIR_STEAL_PTR(net->bandwidth->out, bandwidth->out);
> > +        }
> > +    }
>
> Doesn't look quite right, you just lost any way of resetting the bandwidth when
> in fact this should be possible simply with setting .average=0, that's why the
> original QEMU code uses booleans, because then at the end, the whole
> net->bandwidth structure is set to NULL if reset was requested.
>
> Erik

Aaah, right. This is one of the cases where many implicit comparisons
can be confusing. When I was reading that code I was wondering how
these booleans are useful at all. Now I get it, I'll send a v2.

Thanks,
Ilias

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