From 394302c93c399eaab2e2ff5190d1667578704783 Mon Sep 17 00:00:00 2001 From: Predrag Rogic Date: Wed, 7 Dec 2022 10:07:40 +0000 Subject: [PATCH] remove unrelated kvm stuff --- pkg/drivers/kvm/network.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pkg/drivers/kvm/network.go b/pkg/drivers/kvm/network.go index 08215df2cd0e..08731512c366 100644 --- a/pkg/drivers/kvm/network.go +++ b/pkg/drivers/kvm/network.go @@ -477,20 +477,19 @@ func ifListFromAPI(conn *libvirt.Connect, domain string) ([]libvirt.DomainInterf } defer func() { _ = dom.Free() }() - // check lease first, then arp - // ref: https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInterfaceAddresses - ifs, err := dom.ListAllInterfaceAddresses(libvirt.DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE) - if err == nil && len(ifs) > 0 { - return ifs, nil - } - if err != nil { - log.Debugf("failed listing network interface addresses of domain %s using lease (will try arp): %v", domain, err) - } else if len(ifs) == 0 { - log.Debugf("no network interface addresses found for domain %s using lease (will try arp)", domain) - } - ifs, err = dom.ListAllInterfaceAddresses(libvirt.DOMAIN_INTERFACE_ADDRESSES_SRC_ARP) - if err != nil { - return nil, fmt.Errorf("failed listing network interface addresses of domain %s using arp: %w", domain, err) + ifs, err := dom.ListAllInterfaceAddresses(libvirt.DOMAIN_INTERFACE_ADDRESSES_SRC_ARP) + if ifs == nil { + if err != nil { + log.Debugf("failed listing network interface addresses of domain %s(source=arp): %w", domain, err) + } else { + log.Debugf("No network interface addresses found for domain %s(source=arp)", domain) + } + log.Debugf("trying to list again with source=lease") + + ifs, err = dom.ListAllInterfaceAddresses(libvirt.DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE) + if err != nil { + return nil, fmt.Errorf("failed listing network interface addresses of domain %s(source=lease): %w", domain, err) + } } return ifs, nil