Browse Source

daemon: ContainerRename: move log args to log fields

Also, err `e` is renamed into the more standard `err` as the defer
already uses `retErr` to avoid clashes (changed in f5a611a74).

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Albin Kerouanton 1 year ago
parent
commit
b1676a289c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      daemon/rename.go

+ 5 - 2
daemon/rename.go

@@ -102,8 +102,11 @@ func (daemon *Daemon) ContainerRename(oldName, newName string) (retErr error) {
 		if retErr != nil {
 		if retErr != nil {
 			container.Name = oldName
 			container.Name = oldName
 			container.NetworkSettings.IsAnonymousEndpoint = oldIsAnonymousEndpoint
 			container.NetworkSettings.IsAnonymousEndpoint = oldIsAnonymousEndpoint
-			if e := container.CheckpointTo(daemon.containersReplica); e != nil {
-				log.G(context.TODO()).Errorf("%s: Failed in writing to Disk on rename failure: %v", container.ID, e)
+			if err := container.CheckpointTo(daemon.containersReplica); err != nil {
+				log.G(context.TODO()).WithFields(log.Fields{
+					"containerID": container.ID,
+					"error":       err,
+				}).Error("failed to write container state to disk during rename")
 			}
 			}
 		}
 		}
 	}()
 	}()