metropolis/node/core/mgmt: add logging for update activation method
Change-Id: Ief4ef6447ac132755df35c5742dedc5d15d71d74
Reviewed-on: https://review.monogon.dev/c/monogon/+/2029
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/mgmt/update.go b/metropolis/node/core/mgmt/update.go
index 144d307..69b8744 100644
--- a/metropolis/node/core/mgmt/update.go
+++ b/metropolis/node/core/mgmt/update.go
@@ -25,16 +25,22 @@
return nil, status.Errorf(codes.Unavailable, "error installing update: %v", err)
}
if req.ActivationMode != apb.ActivationMode_ACTIVATION_NONE {
- // TODO(#253): Tell Supervisor to shut down gracefully and reboot
+
+ methodString, method := "reboot", unix.LINUX_REBOOT_CMD_RESTART
+ if req.ActivationMode == apb.ActivationMode_ACTIVATION_KEXEC {
+ methodString = "kexec"
+ method = unix.LINUX_REBOOT_CMD_KEXEC
+ }
+
+ s.LogTree.MustLeveledFor("update").Infof("activating update with method: %s", methodString)
+
go func() {
+ // TODO(#253): Tell Supervisor to shut down gracefully and reboot
time.Sleep(10 * time.Second)
+ s.LogTree.MustLeveledFor("update").Info("activating now...")
unix.Unmount(s.UpdateService.ESPPath, 0)
unix.Sync()
- if req.ActivationMode == apb.ActivationMode_ACTIVATION_KEXEC {
- unix.Reboot(unix.LINUX_REBOOT_CMD_KEXEC)
- } else {
- unix.Reboot(unix.LINUX_REBOOT_CMD_RESTART)
- }
+ unix.Reboot(method)
}()
}