@@ -7,12 +7,9 @@ package netutils
77
88import (
99 "context"
10- "fmt"
1110 "log"
1211 "time"
1312
14- "github.com/cenkalti/backoff/v4"
15- "github.com/cosi-project/runtime/pkg/safe"
1613 "github.com/cosi-project/runtime/pkg/state"
1714 "github.com/siderolabs/go-retry/retry"
1815
@@ -28,44 +25,6 @@ func Wait(ctx context.Context, r state.State) error {
2825 return network .NewReadyCondition (r , network .AddressReady ).Wait (ctx )
2926}
3027
31- // WaitInterfaces for the interfaces to be up to interact with platform metadata services.
32- func WaitInterfaces (ctx context.Context , r state.State ) error {
33- backoff := backoff .NewExponentialBackOff ()
34- backoff .MaxInterval = 2 * time .Second
35- backoff .MaxElapsedTime = 30 * time .Second
36-
37- for ctx .Err () == nil {
38- hostInterfaces , err := safe .StateListAll [* network.LinkStatus ](ctx , r )
39- if err != nil {
40- return fmt .Errorf ("error listing host interfaces: %w" , err )
41- }
42-
43- numPhysical := 0
44-
45- for iface := range hostInterfaces .All () {
46- if iface .TypedSpec ().Physical () {
47- numPhysical ++
48- }
49- }
50-
51- if numPhysical > 0 {
52- return nil
53- }
54-
55- log .Printf ("waiting for physical network interfaces to appear..." )
56-
57- interval := backoff .NextBackOff ()
58-
59- select {
60- case <- ctx .Done ():
61- return nil
62- case <- time .After (interval ):
63- }
64- }
65-
66- return nil
67- }
68-
6928// WaitForDevicesReady waits for devices to be ready.
7029func WaitForDevicesReady (ctx context.Context , r state.State ) error {
7130 log .Printf ("waiting for devices to be ready..." )
0 commit comments