m/n/c/cluster: ensure A/B state exists
We always want to make sure that A/B boot state tracking is done, even when registering or bootstrapping. Call MarkBootSuccessful for both remaining paths.
Change-Id: I7ffa5d05e0e038dd816a5e3dc488948bb37501b2
Reviewed-on: https://review.monogon.dev/c/monogon/+/3390
Reviewed-by: Serge Bazanski <serge@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 0c9d7fe..fdfb44a 100644
--- a/metropolis/node/core/cluster/cluster_bootstrap.go
+++ b/metropolis/node/core/cluster/cluster_bootstrap.go
@@ -167,6 +167,10 @@
bd.Cluster.Configuration = cc
m.roleServer.ProvideBootstrapData(&bd)
+ if err := m.updateService.MarkBootSuccessful(); err != nil {
+ supervisor.Logger(ctx).Errorf("Failed to mark boot as successful: %v", err)
+ }
+
supervisor.Signal(ctx, supervisor.SignalHealthy)
supervisor.Signal(ctx, supervisor.SignalDone)
return nil
diff --git a/metropolis/node/core/cluster/cluster_register.go b/metropolis/node/core/cluster/cluster_register.go
index 36f7394..2175f04 100644
--- a/metropolis/node/core/cluster/cluster_register.go
+++ b/metropolis/node/core/cluster/cluster_register.go
@@ -186,6 +186,9 @@
if err = m.storageRoot.ESP.Metropolis.SealedConfiguration.SealSecureBoot(&sc, res.TpmUsage); err != nil {
return err
}
+ if err := m.updateService.MarkBootSuccessful(); err != nil {
+ supervisor.Logger(ctx).Errorf("Failed to mark boot as successful: %v", err)
+ }
unix.Sync()
// All synced up, we can now let downstream know about the creds, which in turn