summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-07 09:43:38 -0400
committerGitHub <noreply@github.com>2020-09-07 09:43:38 -0400
commitabb474054c81535d2f696601646b01e3483c2fa5 (patch)
tree01abe8b5a5d745ed8e9c859890337edda7d28af2 /pkg
parent21c6aaeb857404309abe6a82e0541fd08fc615c7 (diff)
parentf6a988547be825ad78d9fe106181eafbc3ddf20c (diff)
downloadpodman-abb474054c81535d2f696601646b01e3483c2fa5.tar.gz
podman-abb474054c81535d2f696601646b01e3483c2fa5.tar.bz2
podman-abb474054c81535d2f696601646b01e3483c2fa5.zip
Merge pull request #7540 from QiWang19/system-df
Fix system df inconsistent
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/entities/system.go7
-rw-r--r--pkg/domain/infra/abi/system.go11
2 files changed, 12 insertions, 6 deletions
diff --git a/pkg/domain/entities/system.go b/pkg/domain/entities/system.go
index af355b0af..bde2b6ef2 100644
--- a/pkg/domain/entities/system.go
+++ b/pkg/domain/entities/system.go
@@ -75,9 +75,10 @@ type SystemDfContainerReport struct {
// SystemDfVolumeReport describes a volume and its size
type SystemDfVolumeReport struct {
- VolumeName string
- Links int
- Size int64
+ VolumeName string
+ Links int
+ Size int64
+ ReclaimableSize int64
}
// SystemResetOptions describes the options for resetting your
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index ff1052d86..914a7681d 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -313,6 +313,7 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
}
dfVolumes := make([]*entities.SystemDfVolumeReport, 0, len(vols))
+ var reclaimableSize int64
for _, v := range vols {
var consInUse int
volSize, err := sizeOfPath(v.MountPoint())
@@ -323,15 +324,19 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System
if err != nil {
return nil, err
}
+ if len(inUse) == 0 {
+ reclaimableSize += volSize
+ }
for _, viu := range inUse {
if util.StringInSlice(viu, runningContainers) {
consInUse++
}
}
report := entities.SystemDfVolumeReport{
- VolumeName: v.Name(),
- Links: consInUse,
- Size: volSize,
+ VolumeName: v.Name(),
+ Links: consInUse,
+ Size: volSize,
+ ReclaimableSize: reclaimableSize,
}
dfVolumes = append(dfVolumes, &report)
}