@@ -26,6 +26,7 @@ const module = "monitor"
2626func cap (ctx context.Context , client zbus.Client ) {
2727 storage := stubs .NewStorageModuleStub (client )
2828 identity := stubs .NewIdentityManagerStub (client )
29+ network := stubs .NewNetworkerStub (client )
2930 cl , err := bcdbClient ()
3031 if err != nil {
3132 log .Fatal ().Err (err ).Msg ("failed to connect to bcdb backend" )
@@ -34,6 +35,17 @@ func cap(ctx context.Context, client zbus.Client) {
3435 // call this now so we block here until identityd is ready to serve us
3536 nodeID := identity .NodeID ().Identity ()
3637
38+ // block until networkd is ready to serve request from zbus
39+ // this is used to prevent uptime and online status to the explorer if the node is not in a fully ready
40+ // https://github.com/threefoldtech/zos/issues/632
41+ bo := backoff .NewExponentialBackOff ()
42+ bo .MaxElapsedTime = 0
43+ backoff .RetryNotify (func () error {
44+ return network .Ready ()
45+ }, bo , func (err error , d time.Duration ) {
46+ log .Error ().Err (err ).Msgf ("networkd is not ready yet" )
47+ })
48+
3749 r := capacity .NewResourceOracle (storage )
3850
3951 log .Info ().Msg ("inspect hardware resources" )
@@ -75,7 +87,7 @@ func cap(ctx context.Context, client zbus.Client) {
7587 log .Info ().Msg ("sends capacity detail to BCDB" )
7688 return cl .NodeSetCapacity (nodeID , ru , * dmi , disks , hypervisor )
7789 }
78- bo : = backoff .NewExponentialBackOff ()
90+ bo = backoff .NewExponentialBackOff ()
7991 bo .MaxElapsedTime = 0 // retry forever
8092 backoff .RetryNotify (setCapacity , bo , func (err error , d time.Duration ) {
8193 log .Error ().
0 commit comments