summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-03-15 17:09:31 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-16 13:35:23 +0000
commit8840b92da603f9db5ba2590f4b0836ad580fbe56 (patch)
tree9301955b4a483c07b5257a6530b4eb6ecc648165
parenteb33cc2193b0dfdae359b3fd7cd18ef0f4284f75 (diff)
downloadpodman-8840b92da603f9db5ba2590f4b0836ad580fbe56.tar.gz
podman-8840b92da603f9db5ba2590f4b0836ad580fbe56.tar.bz2
podman-8840b92da603f9db5ba2590f4b0836ad580fbe56.zip
Remove ability to specify mount label when mounting
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #506 Approved by: rhatdan
-rw-r--r--cmd/podman/mount.go2
-rw-r--r--completions/bash/podman1
-rw-r--r--libpod/container_api.go27
3 files changed, 9 insertions, 21 deletions
diff --git a/cmd/podman/mount.go b/cmd/podman/mount.go
index 6c6b89ee9..2d274cfaf 100644
--- a/cmd/podman/mount.go
+++ b/cmd/podman/mount.go
@@ -79,7 +79,7 @@ func mountCmd(c *cli.Context) error {
if err != nil {
return errors.Wrapf(err, "error looking up container %q", args[0])
}
- mountPoint, err := ctr.Mount(ctr.MountLabel())
+ mountPoint, err := ctr.Mount()
if err != nil {
return errors.Wrapf(err, "error mounting container %q", ctr.ID())
}
diff --git a/completions/bash/podman b/completions/bash/podman
index 7e60d1e81..d4334d68b 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -1000,7 +1000,6 @@ _podman_mount() {
"
local options_with_args="
- --label
--format
"
diff --git a/libpod/container_api.go b/libpod/container_api.go
index cfffa2232..ef94aa4c9 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -368,7 +368,7 @@ func (c *Container) Attach(noStdin bool, keys string) error {
// Mount mounts a container's filesystem on the host
// The path where the container has been mounted is returned
-func (c *Container) Mount(label string) (string, error) {
+func (c *Container) Mount() (string, error) {
if !c.locked {
c.lock.Lock()
defer c.lock.Unlock()
@@ -378,27 +378,11 @@ func (c *Container) Mount(label string) (string, error) {
}
}
- // return mountpoint if container already mounted
- if c.state.Mounted {
- return c.state.Mountpoint, nil
- }
-
- mountLabel := label
- if label == "" {
- mountLabel = c.config.MountLabel
- }
- mountPoint, err := c.runtime.store.Mount(c.ID(), mountLabel)
- if err != nil {
+ if err := c.mountStorage(); err != nil {
return "", err
}
- c.state.Mountpoint = mountPoint
- c.state.Mounted = true
- if err := c.save(); err != nil {
- return "", err
- }
-
- return mountPoint, nil
+ return c.state.Mountpoint, nil
}
// Unmount unmounts a container's filesystem on the host
@@ -416,6 +400,11 @@ func (c *Container) Unmount() error {
return errors.Wrapf(ErrCtrStateInvalid, "cannot remove storage for container %s as it is running or paused", c.ID())
}
+ // Check if we have active exec sessions
+ if len(c.state.ExecSessions) != 0 {
+ return errors.Wrapf(ErrCtrStateInvalid, "container %s has active exec sessions, refusing to clean up", c.ID())
+ }
+
return c.cleanupStorage()
}