Skip to content

Commit

Permalink
Merge pull request #2636 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2631-to-release-4.8

[release-4.8] Bug 1975078: Gracefully shutdown taking around 6-7 mins (libvirt provider)
  • Loading branch information
openshift-ci[bot] authored Aug 12, 2021
2 parents d0db136 + a7ef54f commit 8423356
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig) (retErr err

dn.catchIgnoreSIGTERM()
defer func() {
if retErr != nil {
dn.cancelSIGTERM()
}
// now that we do rebootless updates, we need to turn off our SIGTERM protection
// regardless of how we leave the "update loop"
dn.cancelSIGTERM()
}()

oldConfigName := oldConfig.GetName()
Expand Down Expand Up @@ -1893,13 +1893,15 @@ func (dn *Daemon) catchIgnoreSIGTERM() {
if dn.updateActive {
return
}
glog.Info("Adding SIGTERM protection")
dn.updateActive = true
}

func (dn *Daemon) cancelSIGTERM() {
dn.updateActiveLock.Lock()
defer dn.updateActiveLock.Unlock()
if dn.updateActive {
glog.Info("Removing SIGTERM protection")
dn.updateActive = false
}
}
Expand Down

0 comments on commit 8423356

Please sign in to comment.