mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #59400 from jianglingxia/jlx-2018020614
Automatic merge from submit-queue (batch tested with PRs 57230, 59400). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. make sure mounter not nil and fix some typo **What this PR does / why we need it**: make sure mounter not nil then and fix some typo **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
a1437feb18
@ -239,7 +239,7 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
|
|
||||||
// check whether it belongs to fuse, if not, default to use kernel mount.
|
// check whether it belongs to fuse, if not, default to use kernel mount.
|
||||||
if cephfsVolume.checkFuseMount() {
|
if cephfsVolume.checkFuseMount() {
|
||||||
glog.V(4).Infof("CephFS fuse mount.")
|
glog.V(4).Info("CephFS fuse mount.")
|
||||||
err = cephfsVolume.execFuseMount(dir)
|
err = cephfsVolume.execFuseMount(dir)
|
||||||
// cleanup no matter if fuse mount fail.
|
// cleanup no matter if fuse mount fail.
|
||||||
keyringPath := cephfsVolume.GetKeyringPath()
|
keyringPath := cephfsVolume.GetKeyringPath()
|
||||||
@ -255,7 +255,7 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||||||
glog.V(4).Infof("CephFS fuse mount failed: %v, fallback to kernel mount.", err)
|
glog.V(4).Infof("CephFS fuse mount failed: %v, fallback to kernel mount.", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("CephFS kernel mount.")
|
glog.V(4).Info("CephFS kernel mount.")
|
||||||
|
|
||||||
err = cephfsVolume.execMount(dir)
|
err = cephfsVolume.execMount(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -336,7 +336,7 @@ func (cephfsMounter *cephfsMounter) checkFuseMount() bool {
|
|||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux":
|
case "linux":
|
||||||
if _, err := execute.Run("/usr/bin/test", "-x", "/sbin/mount.fuse.ceph"); err == nil {
|
if _, err := execute.Run("/usr/bin/test", "-x", "/sbin/mount.fuse.ceph"); err == nil {
|
||||||
glog.V(4).Infof("/sbin/mount.fuse.ceph exists, it should be fuse mount.")
|
glog.V(4).Info("/sbin/mount.fuse.ceph exists, it should be fuse mount.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -351,7 +351,7 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
|||||||
if cephfsVolume.secret != "" {
|
if cephfsVolume.secret != "" {
|
||||||
// TODO: cephfs fuse currently doesn't support secret option,
|
// TODO: cephfs fuse currently doesn't support secret option,
|
||||||
// remove keyring file create once secret option is supported.
|
// remove keyring file create once secret option is supported.
|
||||||
glog.V(4).Infof("cephfs mount begin using fuse.")
|
glog.V(4).Info("cephfs mount begin using fuse.")
|
||||||
|
|
||||||
keyringPath := cephfsVolume.GetKeyringPath()
|
keyringPath := cephfsVolume.GetKeyringPath()
|
||||||
os.MkdirAll(keyringPath, 0750)
|
os.MkdirAll(keyringPath, 0750)
|
||||||
|
@ -77,13 +77,13 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mounter, err := plug.(*cephfsPlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), &mount.FakeMounter{}, "secrets")
|
mounter, err := plug.(*cephfsPlugin).newMounterInternal(volume.NewSpecFromVolume(spec), types.UID("poduid"), &mount.FakeMounter{}, "secrets")
|
||||||
volumePath := mounter.GetPath()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to make a new Mounter: %v", err)
|
t.Errorf("Failed to make a new Mounter: %v", err)
|
||||||
}
|
}
|
||||||
if mounter == nil {
|
if mounter == nil {
|
||||||
t.Errorf("Got a nil Mounter")
|
t.Errorf("Got a nil Mounter")
|
||||||
}
|
}
|
||||||
|
volumePath := mounter.GetPath()
|
||||||
volpath := path.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~cephfs/vol1")
|
volpath := path.Join(tmpDir, "pods/poduid/volumes/kubernetes.io~cephfs/vol1")
|
||||||
if volumePath != volpath {
|
if volumePath != volpath {
|
||||||
t.Errorf("Got unexpected path: %s", volumePath)
|
t.Errorf("Got unexpected path: %s", volumePath)
|
||||||
|
Loading…
Reference in New Issue
Block a user