Browse code

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 authored on 2017/01/24 06:52:33
Showing 2 changed files
... ...
@@ -196,7 +196,10 @@ func (c *diskUsageImagesContext) Reclaimable() string {
196 196
 	c.AddHeader(reclaimableHeader)
197 197
 	for _, i := range c.images {
198 198
 		if i.Containers != 0 {
199
-			used += i.Size
199
+			if i.VirtualSize == -1 || i.SharedSize == -1 {
200
+				continue
201
+			}
202
+			used += i.VirtualSize - i.SharedSize
200 203
 		}
201 204
 	}
202 205
 
... ...
@@ -205,7 +205,7 @@ func (daemon *Daemon) Images(imageFilters filters.Args, all bool, withExtraAttrs
205 205
 	}
206 206
 
207 207
 	if withExtraAttrs {
208
-		// Get Shared and Unique sizes
208
+		// Get Shared sizes
209 209
 		for img, newImage := range imagesMap {
210 210
 			rootFS := *img.RootFS
211 211
 			rootFS.DiffIDs = nil