Fixed mounting with containerized kubelet.

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.
This commit is contained in:
Jan Safranek
2016-03-24 17:27:11 +01:00
parent f89432e44b
commit 92f181174b
2 changed files with 7 additions and 0 deletions

View File

@@ -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)