Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -190,6 +190,11 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
| 190 | 190 |
ctr.client.lock(ctr.containerID) |
| 191 | 191 |
defer ctr.client.unlock(ctr.containerID) |
| 192 | 192 |
ctr.restarting = false |
| 193 |
+ if err == nil {
|
|
| 194 |
+ if err = ctr.start(); err != nil {
|
|
| 195 |
+ logrus.Errorf("libcontainerd: error restarting %v", err)
|
|
| 196 |
+ } |
|
| 197 |
+ } |
|
| 193 | 198 |
if err != nil {
|
| 194 | 199 |
st.State = StateExit |
| 195 | 200 |
ctr.clean() |
| ... | ... |
@@ -201,8 +206,6 @@ func (ctr *container) handleEvent(e *containerd.Event) error {
|
| 201 | 201 |
if err != restartmanager.ErrRestartCanceled {
|
| 202 | 202 |
logrus.Errorf("libcontainerd: %v", err)
|
| 203 | 203 |
} |
| 204 |
- } else {
|
|
| 205 |
- ctr.start() |
|
| 206 | 204 |
} |
| 207 | 205 |
}() |
| 208 | 206 |
} |
| ... | ... |
@@ -260,14 +260,16 @@ func (ctr *container) waitExit(process *process, isFirstProcessToStart bool) err |
| 260 | 260 |
err := <-waitRestart |
| 261 | 261 |
ctr.restarting = false |
| 262 | 262 |
ctr.client.deleteContainer(ctr.friendlyName) |
| 263 |
+ if err == nil {
|
|
| 264 |
+ if err = ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...); err != nil {
|
|
| 265 |
+ logrus.Errorf("libcontainerd: error restarting %v", err)
|
|
| 266 |
+ } |
|
| 267 |
+ } |
|
| 263 | 268 |
if err != nil {
|
| 264 | 269 |
si.State = StateExit |
| 265 | 270 |
if err := ctr.client.backend.StateChanged(ctr.containerID, si); err != nil {
|
| 266 | 271 |
logrus.Error(err) |
| 267 | 272 |
} |
| 268 |
- logrus.Error(err) |
|
| 269 |
- } else {
|
|
| 270 |
- ctr.client.Create(ctr.containerID, ctr.ociSpec, ctr.options...) |
|
| 271 | 273 |
} |
| 272 | 274 |
}() |
| 273 | 275 |
} |