Add docker info show base filesystem size of container/image when use devicemapper
| ... | ... |
@@ -49,6 +49,7 @@ will display something like: |
| 49 | 49 |
Storage Driver: devicemapper |
| 50 | 50 |
Pool Name: docker-253:1-17538953-pool |
| 51 | 51 |
Pool Blocksize: 65.54 kB |
| 52 |
+ Base Device Size: 107.4 GB |
|
| 52 | 53 |
Data file: /dev/loop4 |
| 53 | 54 |
Metadata file: /dev/loop4 |
| 54 | 55 |
Data Space Used: 2.536 GB |
| ... | ... |
@@ -69,6 +70,7 @@ Each item in the indented section under `Storage Driver: devicemapper` are |
| 69 | 69 |
status information about the driver. |
| 70 | 70 |
* `Pool Name` name of the devicemapper pool for this driver. |
| 71 | 71 |
* `Pool Blocksize` tells the blocksize the thin pool was initialized with. This only changes on creation. |
| 72 |
+ * `Base Device Size` tells the maximum size of a container and image |
|
| 72 | 73 |
* `Data file` blockdevice file used for the devicemapper data |
| 73 | 74 |
* `Metadata file` blockdevice file used for the devicemapper metadata |
| 74 | 75 |
* `Data Space Used` tells how much of `Data file` is currently used |
| ... | ... |
@@ -146,6 +146,8 @@ type Status struct {
|
| 146 | 146 |
Data DiskUsage |
| 147 | 147 |
// Metadata is the disk used for meta data. |
| 148 | 148 |
Metadata DiskUsage |
| 149 |
+ // BaseDeviceSize is base size of container and image |
|
| 150 |
+ BaseDeviceSize uint64 |
|
| 149 | 151 |
// SectorSize size of the vector. |
| 150 | 152 |
SectorSize uint64 |
| 151 | 153 |
// UdevSyncSupported is true if sync is supported. |
| ... | ... |
@@ -833,6 +835,14 @@ func getDeviceUUID(device string) (string, error) {
|
| 833 | 833 |
return uuid, nil |
| 834 | 834 |
} |
| 835 | 835 |
|
| 836 |
+func (devices *DeviceSet) getBaseDeviceSize() uint64 {
|
|
| 837 |
+ info, _ := devices.lookupDevice("")
|
|
| 838 |
+ if info == nil {
|
|
| 839 |
+ return 0 |
|
| 840 |
+ } |
|
| 841 |
+ return info.Size |
|
| 842 |
+} |
|
| 843 |
+ |
|
| 836 | 844 |
func (devices *DeviceSet) verifyBaseDeviceUUID(baseInfo *devInfo) error {
|
| 837 | 845 |
devices.Lock() |
| 838 | 846 |
defer devices.Unlock() |
| ... | ... |
@@ -2198,6 +2208,7 @@ func (devices *DeviceSet) Status() *Status {
|
| 2198 | 2198 |
status.DeferredRemoveEnabled = devices.deferredRemove |
| 2199 | 2199 |
status.DeferredDeleteEnabled = devices.deferredDelete |
| 2200 | 2200 |
status.DeferredDeletedDeviceCount = devices.nrDeletedDevices |
| 2201 |
+ status.BaseDeviceSize = devices.getBaseDeviceSize() |
|
| 2201 | 2202 |
|
| 2202 | 2203 |
totalSizeInSectors, _, dataUsed, dataTotal, metadataUsed, metadataTotal, err := devices.poolStatus() |
| 2203 | 2204 |
if err == nil {
|
| ... | ... |
@@ -79,6 +79,7 @@ func (d *Driver) Status() [][2]string {
|
| 79 | 79 |
status := [][2]string{
|
| 80 | 80 |
{"Pool Name", s.PoolName},
|
| 81 | 81 |
{"Pool Blocksize", fmt.Sprintf("%s", units.HumanSize(float64(s.SectorSize)))},
|
| 82 |
+ {"Base Device Size", fmt.Sprintf("%s", units.HumanSize(float64(s.BaseDeviceSize)))},
|
|
| 82 | 83 |
{"Backing Filesystem", backingFs},
|
| 83 | 84 |
{"Data file", s.DataFile},
|
| 84 | 85 |
{"Metadata file", s.MetadataFile},
|