Browse code

Add Size and RefCount fields to types.Volume

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

Kenfe-Mickael Laventure authored on 2016/08/24 08:17:13
Showing 2 changed files
... ...
@@ -438,6 +438,8 @@ type Volume struct {
438 438
 	Status     map[string]interface{} `json:",omitempty"` // Status provides low-level status information about the volume
439 439
 	Labels     map[string]string      // Labels is metadata specific to the volume
440 440
 	Scope      string                 // Scope describes the level at which the volume exists (e.g. `global` for cluster-wide or `local` for machine level)
441
+	Size       int64                  // Size holds how much disk space is used by the (local driver only). Sets to -1 if not provided.
442
+	RefCount   int                    // RefCount holds the number of containers having this volume attached to them. Sets to -1 if not provided.
441 443
 }
442 444
 
443 445
 // VolumesListResponse contains the response for the remote API:
... ...
@@ -27,8 +27,10 @@ type mounts []container.Mount
27 27
 // volumeToAPIType converts a volume.Volume to the type used by the remote API
28 28
 func volumeToAPIType(v volume.Volume) *types.Volume {
29 29
 	tv := &types.Volume{
30
-		Name:   v.Name(),
31
-		Driver: v.DriverName(),
30
+		Name:     v.Name(),
31
+		Driver:   v.DriverName(),
32
+		Size:     -1,
33
+		RefCount: -1,
32 34
 	}
33 35
 	if v, ok := v.(volume.LabeledVolume); ok {
34 36
 		tv.Labels = v.Labels()