From f0f455579a034fb5f697bf4247d6e7787e7d0ff2 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Tue, 23 Aug 2016 16:17:13 -0700 Subject: [PATCH] Add Size and RefCount fields to types.Volume Signed-off-by: Kenfe-Mickael Laventure Upstream-commit: c6db1e9c1b1c015a69a37e4efc570cb44d801168 Component: engine --- components/engine/api/types/types.go | 2 ++ components/engine/daemon/volumes.go | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/engine/api/types/types.go b/components/engine/api/types/types.go index baabbebc13..60d1fc2c13 100644 --- a/components/engine/api/types/types.go +++ b/components/engine/api/types/types.go @@ -438,6 +438,8 @@ type Volume struct { Status map[string]interface{} `json:",omitempty"` // Status provides low-level status information about the volume Labels map[string]string // Labels is metadata specific to the volume Scope string // Scope describes the level at which the volume exists (e.g. `global` for cluster-wide or `local` for machine level) + Size int64 // Size holds how much disk space is used by the (local driver only). Sets to -1 if not provided. + RefCount int // RefCount holds the number of containers having this volume attached to them. Sets to -1 if not provided. } // VolumesListResponse contains the response for the remote API: diff --git a/components/engine/daemon/volumes.go b/components/engine/daemon/volumes.go index 11a7d0a5c9..92b8f70200 100644 --- a/components/engine/daemon/volumes.go +++ b/components/engine/daemon/volumes.go @@ -27,8 +27,10 @@ type mounts []container.Mount // volumeToAPIType converts a volume.Volume to the type used by the remote API func volumeToAPIType(v volume.Volume) *types.Volume { tv := &types.Volume{ - Name: v.Name(), - Driver: v.DriverName(), + Name: v.Name(), + Driver: v.DriverName(), + Size: -1, + RefCount: -1, } if v, ok := v.(volume.LabeledVolume); ok { tv.Labels = v.Labels()