libcontainerd: mark container exited after failed restart
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
495448b290
commit
9be0fb45c2
2 changed files with 10 additions and 5 deletions
|
@ -190,6 +190,11 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
|||
ctr.client.lock(ctr.containerID)
|
||||
defer ctr.client.unlock(ctr.containerID)
|
||||
ctr.restarting = false
|
||||
if err == nil {
|
||||
if err = ctr.start(); err != nil {
|
||||
logrus.Errorf("libcontainerd: error restarting %v", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
st.State = StateExit
|
||||
ctr.clean()
|
||||
|
@ -201,8 +206,6 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
|||
if err != restartmanager.ErrRestartCanceled {
|
||||
logrus.Errorf("libcontainerd: %v", err)
|
||||
}
|
||||
} else {
|
||||
ctr.start()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
@ -260,14 +260,16 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err
|
|||
err := <-waitRestart
|
||||
ctr.restarting = false
|
||||
ctr.client.deleteContainer(ctr.friendlyName)
|
||||
if err == nil {
|
||||
if err = ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...); err != nil {
|
||||
logrus.Errorf("libcontainerd: error restarting %v", err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
si.State = StateExit
|
||||
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
logrus.Error(err)
|
||||
} else {
|
||||
ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue