From 04f28d5901df6b86162492c8ce3b914204f844f5 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 14 Dec 2020 14:33:52 +0000 Subject: [PATCH] Bug 1907333: daemon: Move rollback removal to update loop See https://bugzilla.redhat.com/1907333 This needs to be a more proper part of the control loop so that we retry, rather than having the MCD die. Also by doing it here it will happen on firstboot when there's no I/O contention with other processes. --- pkg/daemon/daemon.go | 4 ---- pkg/daemon/update.go | 11 ++++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 3553ea9694..c50621b392 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -1029,10 +1029,6 @@ func (dn *Daemon) checkStateOnFirstRun() error { return fmt.Errorf("error detecting previous SSH accesses: %v", err) } - if err := dn.removeRollback(); err != nil { - return errors.Wrapf(err, "Failed to remove rollback") - } - // Bootstrapping state is when we have the node annotations file if state.bootstrapping { targetOSImageURL := state.currentConfig.Spec.OSImageURL diff --git a/pkg/daemon/update.go b/pkg/daemon/update.go index 9e7eb96633..736adfb0f7 100644 --- a/pkg/daemon/update.go +++ b/pkg/daemon/update.go @@ -422,9 +422,14 @@ func (dn *Daemon) applyOSChanges(oldConfig, newConfig *mcfgv1.MachineConfig) (re } // Update OS - if err := dn.updateOS(newConfig, osImageContentDir); err != nil { - MCDPivotErr.WithLabelValues(dn.node.Name, newConfig.Spec.OSImageURL, err.Error()).SetToCurrentTime() - return err + if mcDiff.osUpdate { + if err := dn.updateOS(newConfig, osImageContentDir); err != nil { + MCDPivotErr.WithLabelValues(dn.node.Name, newConfig.Spec.OSImageURL, err.Error()).SetToCurrentTime() + return err + } + if err := dn.removeRollback(); err != nil { + return err + } } defer func() {