adjust status on container start failure

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-06-10 18:18:59 +02:00
parent 3f56193a15
commit 0b2f6b5354
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
4 changed files with 39 additions and 7 deletions

View file

@ -545,6 +545,15 @@ func (r *Runtime) DeleteContainer(c *Container) error {
return err
}
// SetStartFailed sets the container state appropriately after a start failure
func (r *Runtime) SetStartFailed(c *Container, err error) {
c.opLock.Lock()
defer c.opLock.Unlock()
// adjust finished and started times
c.state.Finished, c.state.Started = c.state.Created, c.state.Created
c.state.Error = err.Error()
}
// UpdateStatus refreshes the status of the container.
func (r *Runtime) UpdateStatus(c *Container) error {
c.opLock.Lock()