Skip to content

Commit

Permalink
Fixed mounting with containerized kubelet.
Browse files Browse the repository at this point in the history
Kubelet was not able to mount volumes when running inside a container and
using nsenter mounter,

NsenterMounter.IsLikelyNotMountPoint() should return ErrNotExist when the
checked directory does not exists as the regular mounted does this and
some volume plugins depend on this behavior.
  • Loading branch information
jsafrane committed Mar 24, 2016
1 parent f89432e commit 92f1811
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/util/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Interface interface {
// consistent.
List() ([]MountPoint, error)
// IsLikelyNotMountPoint determines if a directory is a mountpoint.
// It should return ErrNotExist when the directory does not exist.
IsLikelyNotMountPoint(file string) (bool, error)
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/util/mount/nsenter_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ func (n *NsenterMounter) IsLikelyNotMountPoint(file string) (bool, error) {
return true, err
}

// Check the directory exists
if _, err = os.Stat(file); os.IsNotExist(err) {
glog.V(5).Infof("findmnt: directory %s does not exist", file)
return true, err
}

args := []string{"--mount=/rootfs/proc/1/ns/mnt", "--", n.absHostPath("findmnt"), "-o", "target", "--noheadings", "--target", file}
glog.V(5).Infof("findmnt command: %v %v", nsenterPath, args)

Expand Down

1 comment on commit 92f1811

@k8s-teamcity-mesosphere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity OSS :: Kubernetes Mesos :: 4 - Smoke Tests Build 19872 outcome was SUCCESS
Summary: Tests passed: 1, ignored: 267 Build time: 00:10:23

Please sign in to comment.