瀏覽代碼

Export Mininum Thin Pool Free Space through docker info

Right now there is no way to know what's the minimum free space threshold
daemon is applying. It would be good to export it through docker info and
then user knows what's the current value. Also this could be useful to
higher level management tools which can look at this value and setup their
own internal thresholds for image garbage collection etc.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Vivek Goyal 9 年之前
父節點
當前提交
55a9b8123d

+ 4 - 0
daemon/graphdriver/devmapper/deviceset.go

@@ -167,6 +167,7 @@ type Status struct {
 	// thin pool and it can't be activated again.
 	DeferredDeleteEnabled      bool
 	DeferredDeletedDeviceCount uint
+	MinFreeSpace               uint64
 }
 
 // Structure used to export image/container metadata in docker inspect.
@@ -2469,6 +2470,9 @@ func (devices *DeviceSet) Status() *Status {
 				status.Metadata.Available = actualSpace
 			}
 		}
+
+		minFreeData := (dataTotal * uint64(devices.minFreeSpacePercent)) / 100
+		status.MinFreeSpace = minFreeData * blockSizeInSectors * 512
 	}
 
 	return status

+ 1 - 0
daemon/graphdriver/devmapper/driver.go

@@ -74,6 +74,7 @@ func (d *Driver) Status() [][2]string {
 		{"Metadata Space Used", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Used)))},
 		{"Metadata Space Total", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Total)))},
 		{"Metadata Space Available", fmt.Sprintf("%s", units.HumanSize(float64(s.Metadata.Available)))},
+		{"Thin Pool Minimum Free Space", fmt.Sprintf("%s", units.HumanSize(float64(s.MinFreeSpace)))},
 		{"Udev Sync Supported", fmt.Sprintf("%v", s.UdevSyncSupported)},
 		{"Deferred Removal Enabled", fmt.Sprintf("%v", s.DeferredRemoveEnabled)},
 		{"Deferred Deletion Enabled", fmt.Sprintf("%v", s.DeferredDeleteEnabled)},

+ 1 - 0
docs/userguide/storagedriver/selectadriver.md

@@ -109,6 +109,7 @@ The following command shows how to start the Docker daemon with the
      Metadata Space Used: 1.479 MB
      Metadata Space Total: 2.147 GB
      Metadata Space Available: 2.146 GB
+     Thin Pool Minimum Free Space: 10.74 GB
      Udev Sync Supported: true
      Deferred Removal Enabled: false
      Data loop file: /var/lib/docker/devicemapper/devicemapper/data