Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Change the log level in RemoveContainer to debug
Browse files Browse the repository at this point in the history
RemoveContainer() is called before a VM is created and after a VM is
deleted. This results in warning logs with container or task not found
for the basic operations even when nothing wrong happened. The warning
could be misleading. Move the `not found` logs in RemoveContainer() to
debug level to avoid such confusion.
  • Loading branch information
darkowlzz committed Mar 27, 2021
1 parent 44f95a4 commit 56bcf04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/runtime/containerd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ func (cc *ctdClient) RemoveContainer(container string) error {
// Remove the container if it exists
cont, contLoadErr := cc.client.LoadContainer(cc.ctx, container)
if errdefs.IsNotFound(contLoadErr) {
log.Warn(contLoadErr)
log.Debug(contLoadErr)
return nil
} else if contLoadErr != nil {
return contLoadErr
Expand All @@ -699,20 +699,20 @@ func (cc *ctdClient) RemoveContainer(container string) error {
// Load the container's task without attaching
task, taskLoadErr := cont.Task(cc.ctx, nil)
if errdefs.IsNotFound(taskLoadErr) {
log.Warn(taskLoadErr)
log.Debug(taskLoadErr)
} else if taskLoadErr != nil {
return taskLoadErr
} else {
_, taskDeleteErr := task.Delete(cc.ctx)
if taskDeleteErr != nil {
log.Warn(taskDeleteErr)
log.Debug(taskDeleteErr)
}
}

// Delete the container
deleteContErr := cont.Delete(cc.ctx, containerd.WithSnapshotCleanup)
if errdefs.IsNotFound(contLoadErr) {
log.Warn(contLoadErr)
log.Debug(contLoadErr)
} else if deleteContErr != nil {
return deleteContErr
}
Expand Down

0 comments on commit 56bcf04

Please # to comment.