diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-12-28 12:35:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-28 12:35:23 +0100 |
commit | 24b4921508be011b8fc4707d262116f77c8a176b (patch) | |
tree | c9e6252ca41e337e2c69804e107f4cb2db339b1a /libpod/container_internal.go | |
parent | 269b17349631e260cafda2a607c0650299705394 (diff) | |
parent | 2a5c235f789e866cb2c1d0fd54cc23c13bc1fc69 (diff) | |
download | podman-24b4921508be011b8fc4707d262116f77c8a176b.tar.gz podman-24b4921508be011b8fc4707d262116f77c8a176b.tar.bz2 podman-24b4921508be011b8fc4707d262116f77c8a176b.zip |
Merge pull request #4753 from NevilleC/nc-missingsize
Ensure SizeRw is shown when a user does 'inspect --size -t container'.
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 9d97ac5d6..562f783a7 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -84,7 +84,7 @@ func (c *Container) rootFsSize() (int64, error) { return size + layerSize, err } -// rwSize Gets the size of the mutable top layer of the container. +// rwSize gets the size of the mutable top layer of the container. func (c *Container) rwSize() (int64, error) { if c.config.Rootfs != "" { var size int64 @@ -103,14 +103,16 @@ func (c *Container) rwSize() (int64, error) { return 0, err } - // Get the size of the top layer by calculating the size of the diff - // between the layer and its parent. The top layer of a container is - // the only RW layer, all others are immutable - layer, err := c.runtime.store.Layer(container.LayerID) + // The top layer of a container is + // the only readable/writeable layer, all others are immutable. + rwLayer, err := c.runtime.store.Layer(container.LayerID) if err != nil { return 0, err } - return c.runtime.store.DiffSize(layer.Parent, layer.ID) + + // Get the size of the top layer by calculating the size of the diff + // between the layer and its parent. + return c.runtime.store.DiffSize(rwLayer.Parent, rwLayer.ID) } // bundlePath returns the path to the container's root filesystem - where the OCI spec will be |