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>
(cherry picked from commit dcc1b4baf6d0eb068010d071bc44daf72b12cd4a)
Signed-off-by: Victor Vieux <vieux@docker.com>

Kenfe-Mickael Laventure authored on 2017/01/24 06:52:33
Showing 2 changed files
... ...
@@ -192,7 +192,10 @@ func (c *diskUsageImagesContext) Reclaimable() string {
192 192
 	c.AddHeader(reclaimableHeader)
193 193
 	for _, i := range c.images {
194 194
 		if i.Containers != 0 {
195
-			used += i.Size
195
+			if i.VirtualSize == -1 || i.SharedSize == -1 {
196
+				continue
197
+			}
198
+			used += i.VirtualSize - i.SharedSize
196 199
 		}
197 200
 	}
198 201
 
... ...
@@ -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