summaryrefslogtreecommitdiff
path: root/libpod/container_inspect.go
diff options
context:
space:
mode:
authorNeville Cain <neville.cain@qonto.eu>2019-12-27 23:42:38 +0100
committerNeville Cain <neville.cain@qonto.eu>2019-12-27 23:49:34 +0100
commit2a5c235f789e866cb2c1d0fd54cc23c13bc1fc69 (patch)
tree4903937eedc256da041a07fbfc6b02522300e84f /libpod/container_inspect.go
parentc759c3f78dcbbf5dec462a863ad25cd41a1707b7 (diff)
downloadpodman-2a5c235f789e866cb2c1d0fd54cc23c13bc1fc69.tar.gz
podman-2a5c235f789e866cb2c1d0fd54cc23c13bc1fc69.tar.bz2
podman-2a5c235f789e866cb2c1d0fd54cc23c13bc1fc69.zip
Ensure SizeRw is shown when a user does 'inspect --size -t container'.
Currently, if a user requests the size on a container (inspect --size -t container), the SizeRw does not show up if the value is 0. It's because InspectContainerData is defined as int64 and there is an omit when empty. We do want to display it even if the value is empty. I have changed the type of SizeRw to be a pointer to an int64 instead of an int64. It will allow us todistinguish the empty value to the missing value. I updated the test "podman inspect container with size" to ensure we check thatSizeRw is displayed correctly. Closes #4744 Signed-off-by: NevilleC <neville.cain@qonto.eu>
Diffstat (limited to 'libpod/container_inspect.go')
-rw-r--r--libpod/container_inspect.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 22afc61cc..639dd6e91 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -118,7 +118,7 @@ type InspectContainerData struct {
BoundingCaps []string `json:"BoundingCaps"`
ExecIDs []string `json:"ExecIDs"`
GraphDriver *driver.Data `json:"GraphDriver"`
- SizeRw int64 `json:"SizeRw,omitempty"`
+ SizeRw *int64 `json:"SizeRw,omitempty"`
SizeRootFs int64 `json:"SizeRootFs,omitempty"`
Mounts []InspectMount `json:"Mounts"`
Dependencies []string `json:"Dependencies"`
@@ -809,12 +809,13 @@ func (c *Container) getContainerInspectData(size bool, driverData *driver.Data)
if err != nil {
logrus.Errorf("error getting rootfs size %q: %v", config.ID, err)
}
+ data.SizeRootFs = rootFsSize
+
rwSize, err := c.rwSize()
if err != nil {
logrus.Errorf("error getting rw size %q: %v", config.ID, err)
}
- data.SizeRootFs = rootFsSize
- data.SizeRw = rwSize
+ data.SizeRw = &rwSize
}
return data, nil
}