diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-07-19 16:59:42 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2018-07-19 17:01:07 -0400 |
commit | 85db3f09bff68efb0a8509f7470b61604aefb447 (patch) | |
tree | d3f8c2b92dde29066cb9c20fd79db4dc67a86f0e /libpod/storage.go | |
parent | 98703eb204923f06555605c648fc165a55214520 (diff) | |
download | podman-85db3f09bff68efb0a8509f7470b61604aefb447.tar.gz podman-85db3f09bff68efb0a8509f7470b61604aefb447.tar.bz2 podman-85db3f09bff68efb0a8509f7470b61604aefb447.zip |
Let containers/storage keep track of mounts
Currently we unmount storage that is still in use.
We should not be unmounting storeage that we mounted
via a different command or by podman mount. This
change relies on containers/storage to umount keep track of
how many times the storage was mounted before really unmounting
it from the system.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/storage.go')
-rw-r--r-- | libpod/storage.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/storage.go b/libpod/storage.go index ff366edf2..76aa9efa4 100644 --- a/libpod/storage.go +++ b/libpod/storage.go @@ -248,6 +248,21 @@ func (r *storageService) UnmountContainerImage(idOrName string) (bool, error) { return mounted, nil } +func (r *storageService) MountedContainerImage(idOrName string) (int, error) { + if idOrName == "" { + return 0, ErrEmptyID + } + container, err := r.store.Container(idOrName) + if err != nil { + return 0, err + } + mounted, err := r.store.Mounted(container.ID) + if err != nil { + return 0, err + } + return mounted, nil +} + func (r *storageService) GetWorkDir(id string) (string, error) { container, err := r.store.Container(id) if err != nil { |