mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Expand debugging for container cleanup errors
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -350,7 +350,7 @@ func (c *Container) teardownStorage() error {
|
|||||||
|
|
||||||
artifacts := filepath.Join(c.config.StaticDir, artifactsDir)
|
artifacts := filepath.Join(c.config.StaticDir, artifactsDir)
|
||||||
if err := os.RemoveAll(artifacts); err != nil {
|
if err := os.RemoveAll(artifacts); err != nil {
|
||||||
return errors.Wrapf(err, "error removing artifacts %q", artifacts)
|
return errors.Wrapf(err, "error removing container %s artifacts %q", c.ID(), artifacts)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.cleanupStorage(); err != nil {
|
if err := c.cleanupStorage(); err != nil {
|
||||||
@ -1113,13 +1113,13 @@ func (c *Container) cleanup(ctx context.Context) error {
|
|||||||
// Remove healthcheck unit/timer file if it execs
|
// Remove healthcheck unit/timer file if it execs
|
||||||
if c.config.HealthCheckConfig != nil {
|
if c.config.HealthCheckConfig != nil {
|
||||||
if err := c.removeTimer(); err != nil {
|
if err := c.removeTimer(); err != nil {
|
||||||
logrus.Error(err)
|
logrus.Errorf("Error removing timer for container %s healthcheck: %v", c.ID(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up network namespace, if present
|
// Clean up network namespace, if present
|
||||||
if err := c.cleanupNetwork(); err != nil {
|
if err := c.cleanupNetwork(); err != nil {
|
||||||
lastError = err
|
lastError = errors.Wrapf(err, "error removing container %s network", c.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unmount storage
|
// Unmount storage
|
||||||
@ -1127,7 +1127,7 @@ func (c *Container) cleanup(ctx context.Context) error {
|
|||||||
if lastError != nil {
|
if lastError != nil {
|
||||||
logrus.Errorf("Error unmounting container %s storage: %v", c.ID(), err)
|
logrus.Errorf("Error unmounting container %s storage: %v", c.ID(), err)
|
||||||
} else {
|
} else {
|
||||||
lastError = err
|
lastError = errors.Wrapf(err, "error unmounting container %s storage", c.ID())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool,
|
|||||||
// Clean up network namespace, cgroups, mounts
|
// Clean up network namespace, cgroups, mounts
|
||||||
if err := c.cleanup(ctx); err != nil {
|
if err := c.cleanup(ctx); err != nil {
|
||||||
if cleanupErr == nil {
|
if cleanupErr == nil {
|
||||||
cleanupErr = err
|
cleanupErr = errors.Wrapf(err, "error cleaning up container %s", c.ID())
|
||||||
} else {
|
} else {
|
||||||
logrus.Errorf("cleanup network, cgroups, mounts: %v", err)
|
logrus.Errorf("cleanup network, cgroups, mounts: %v", err)
|
||||||
}
|
}
|
||||||
@ -404,12 +404,14 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool,
|
|||||||
// Deallocate the container's lock
|
// Deallocate the container's lock
|
||||||
if err := c.lock.Free(); err != nil {
|
if err := c.lock.Free(); err != nil {
|
||||||
if cleanupErr == nil {
|
if cleanupErr == nil {
|
||||||
cleanupErr = err
|
cleanupErr = errors.Wrapf(err, "error freeing lock for container %s", c.ID())
|
||||||
} else {
|
} else {
|
||||||
logrus.Errorf("free container lock: %v", err)
|
logrus.Errorf("free container lock: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.newContainerEvent(events.Remove)
|
||||||
|
|
||||||
if !removeVolume {
|
if !removeVolume {
|
||||||
return cleanupErr
|
return cleanupErr
|
||||||
}
|
}
|
||||||
@ -425,7 +427,6 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.newContainerEvent(events.Remove)
|
|
||||||
return cleanupErr
|
return cleanupErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user