瀏覽代碼

Ensure proper value is used when computing reclaimable space

When Size was reverted to be equal to VirtualSize, the df command
formatter was not correctly updated to account for the change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Kenfe-Mickael Laventure 8 年之前
父節點
當前提交
dcc1b4baf6
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 4 1
      cli/command/formatter/disk_usage.go
  2. 1 1
      daemon/images.go

+ 4 - 1
cli/command/formatter/disk_usage.go

@@ -196,7 +196,10 @@ func (c *diskUsageImagesContext) Reclaimable() string {
 	c.AddHeader(reclaimableHeader)
 	for _, i := range c.images {
 		if i.Containers != 0 {
-			used += i.Size
+			if i.VirtualSize == -1 || i.SharedSize == -1 {
+				continue
+			}
+			used += i.VirtualSize - i.SharedSize
 		}
 	}
 

+ 1 - 1
daemon/images.go

@@ -205,7 +205,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs
 	}
 
 	if withExtraAttrs {
-		// Get Shared and Unique sizes
+		// Get Shared sizes
 		for img, newImage := range imagesMap {
 			rootFS := *img.RootFS
 			rootFS.DiffIDs = nil