Browse code

Merge pull request #21945 from rhvgoyal/export-min-free-space

Export Mininum Thin Pool Free Space through docker info

Brian Goff authored on 2016/05/03 09:20:08
Showing 3 changed files
... ...
@@ -167,6 +167,7 @@ type Status struct {
167 167
 	// thin pool and it can't be activated again.
168 168
 	DeferredDeleteEnabled      bool
169 169
 	DeferredDeletedDeviceCount uint
170
+	MinFreeSpace               uint64
170 171
 }
171 172
 
172 173
 // Structure used to export image/container metadata in docker inspect.
... ...
@@ -2469,6 +2470,9 @@ func (devices *DeviceSet) Status() *Status {
2469 2469
 				status.Metadata.Available = actualSpace
2470 2470
 			}
2471 2471
 		}
2472
+
2473
+		minFreeData := (dataTotal * uint64(devices.minFreeSpacePercent)) / 100
2474
+		status.MinFreeSpace = minFreeData * blockSizeInSectors * 512
2472 2475
 	}
2473 2476
 
2474 2477
 	return status
... ...
@@ -76,6 +76,7 @@ func (d *Driver) Status() [][2]string {
76 76
 		{"Metadata Space Used", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Used)))},
77 77
 		{"Metadata Space Total", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Total)))},
78 78
 		{"Metadata Space Available", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Available)))},
79
+		{"Thin Pool Minimum Free Space", fmt.Sprintf("%s", units.HumanSize(float64(s.MinFreeSpace)))},
79 80
 		{"Udev Sync Supported", fmt.Sprintf("%v", s.UdevSyncSupported)},
80 81
 		{"Deferred Removal Enabled", fmt.Sprintf("%v", s.DeferredRemoveEnabled)},
81 82
 		{"Deferred Deletion Enabled", fmt.Sprintf("%v", s.DeferredDeleteEnabled)},
... ...
@@ -109,6 +109,7 @@ The following command shows how to start the Docker daemon with the
109 109
      Metadata Space Used: 1.479 MB
110 110
      Metadata Space Total: 2.147 GB
111 111
      Metadata Space Available: 2.146 GB
112
+     Thin Pool Minimum Free Space: 10.74 GB
112 113
      Udev Sync Supported: true
113 114
      Deferred Removal Enabled: false
114 115
      Data loop file: /var/lib/docker/devicemapper/devicemapper/data