m/n/c/core/cluster: notify whenever storage takes longer than 5 seconds to mount
Fixes: https://github.com/monogon-dev/monogon/issues/139
Change-Id: I86398e51cee90c2c5a5a3cb943d85bd09ea311b8
Reviewed-on: https://review.monogon.dev/c/monogon/+/1382
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/cluster/cluster_bootstrap.go b/metropolis/node/core/cluster/cluster_bootstrap.go
index fd990a6..0b51e1a 100644
--- a/metropolis/node/core/cluster/cluster_bootstrap.go
+++ b/metropolis/node/core/cluster/cluster_bootstrap.go
@@ -22,6 +22,7 @@
"crypto/rand"
"encoding/hex"
"fmt"
+ "time"
"source.monogon.dev/metropolis/pkg/supervisor"
apb "source.monogon.dev/metropolis/proto/api"
@@ -36,7 +37,19 @@
// Mount new storage with generated CUK, and save NUK into sealed config proto.
supervisor.Logger(ctx).Infof("Bootstrapping: mounting new storage...")
+ storageDone := make(chan struct{})
+ go func() {
+ t := time.NewTicker(5 * time.Second)
+ defer t.Stop()
+ select {
+ case <-storageDone:
+ return
+ case <-t.C:
+ supervisor.Logger(ctx).Infof("Bootstrapping: still waiting for storage....")
+ }
+ }()
cuk, err := m.storageRoot.Data.MountNew(&configuration)
+ close(storageDone)
if err != nil {
return fmt.Errorf("could not make and mount data partition: %w", err)
}