Skip to content

Commit

Permalink
Bug 1907333: daemon: Move rollback removal to update loop
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cgwalters committed Dec 14, 2020
1 parent d6b5d19 commit 04f28d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 04f28d5

Please sign in to comment.