Skip to content

Commit 9494ba3

Browse files
authored
Merge pull request #322 from stgraber/ovn
incusd/network/ovn: Wait for port to appear
2 parents 7527f27 + 93676dd commit 9494ba3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/server/network/driver_ovn.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/mdlayher/netx/eui64"
16+
ovsClient "github.com/ovn-org/libovsdb/client"
1617

1718
"github.com/lxc/incus/client"
1819
"github.com/lxc/incus/internal/iprange"
@@ -3629,14 +3630,14 @@ func (n *ovn) InstanceDevicePortStart(opts *OVNInstanceNICSetupOpts, securityACL
36293630
// Retry a few times in case port has not yet allocated dynamic IPs.
36303631
for i := 0; i < 5; i++ {
36313632
dynamicIPs, err = ovnnb.LogicalSwitchPortDynamicIPs(instancePortName)
3632-
if err != nil {
3633+
if err == nil {
3634+
if len(dynamicIPs) > 0 {
3635+
break
3636+
}
3637+
} else if err != ovsClient.ErrNotFound {
36333638
return "", nil, err
36343639
}
36353640

3636-
if len(dynamicIPs) > 0 {
3637-
break
3638-
}
3639-
36403641
time.Sleep(100 * time.Millisecond)
36413642
}
36423643

0 commit comments

Comments
 (0)