From 55a9b8123d7e89692b5c25c846cf6707a8ce463a Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Thu, 21 Apr 2016 15:42:23 +0000 Subject: [PATCH] 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 --- daemon/graphdriver/devmapper/deviceset.go | 4 ++++ daemon/graphdriver/devmapper/driver.go | 1 + docs/userguide/storagedriver/selectadriver.md | 1 + 3 files changed, 6 insertions(+) diff --git a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go index 7d350aaf50..ccf9855221 100644 --- a/daemon/graphdriver/devmapper/deviceset.go +++ b/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 diff --git a/daemon/graphdriver/devmapper/driver.go b/daemon/graphdriver/devmapper/driver.go index 100c4ba8a8..946c572955 100644 --- a/daemon/graphdriver/devmapper/driver.go +++ b/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)}, diff --git a/docs/userguide/storagedriver/selectadriver.md b/docs/userguide/storagedriver/selectadriver.md index a741a137c8..235d9babc8 100644 --- a/docs/userguide/storagedriver/selectadriver.md +++ b/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