[libvirt] [PATCH 2/3] test_driver: return addresses only for nets of type network

Ilias Stamatis stamatis.iliass at gmail.com
Wed Jun 19 14:21:54 UTC 2019


On Wed, Jun 19, 2019 at 3:48 PM Michal Privoznik <mprivozn at redhat.com> wrote:
>
> On 6/19/19 1:18 PM, Ilias Stamatis wrote:
> > Signed-off-by: Ilias Stamatis <stamatis.iliass at gmail.com>
> > ---
> >   src/test/test_driver.c | 9 +++++----
> >   1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> > index 437df9cdf9..0c2cfdd2f7 100644
> > --- a/src/test/test_driver.c
> > +++ b/src/test/test_driver.c
> > @@ -3409,10 +3409,10 @@ testDomainInterfaceAddresses(virDomainPtr dom,
> >       if (virDomainObjCheckActive(vm) < 0)
> >           goto cleanup;
> >
> > -    if (VIR_ALLOC_N(ifaces_ret, vm->def->nnets) < 0)
> > -        goto cleanup;
> > -
> >       for (i = 0; i < vm->def->nnets; i++) {
> > +        if (vm->def->nets[i]->type != VIR_DOMAIN_NET_TYPE_NETWORK)
> > +            continue;
> > +
> >           if (VIR_ALLOC(iface) < 0)
> >               goto cleanup;
> >
> > @@ -3433,7 +3433,8 @@ testDomainInterfaceAddresses(virDomainPtr dom,
> >
> >           iface->naddrs = 1;
> >
> > -        VIR_APPEND_ELEMENT_INPLACE(ifaces_ret, ifaces_count, iface);
> > +        if (VIR_APPEND_ELEMENT(ifaces_ret, ifaces_count, iface) < 0)
> > +            goto cleanup;
> >       }
> >
> >       VIR_STEAL_PTR(*ifaces, ifaces_ret);
>
>
> I understand why you want this, but can't we keep the old behaviour for
> non-network interfaces?
>
> Michal

Sure, let's do it like that. I'll include the change in the new patch.

Ilias




More information about the libvir-list mailing list