Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
763fd53a
Commit
763fd53a
authored
Feb 06, 2018
by
jianglingxia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure mounter not nil and fix some typo
parent
5aa68f52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
cephfs.go
pkg/volume/cephfs/cephfs.go
+4
-4
cephfs_test.go
pkg/volume/cephfs/cephfs_test.go
+1
-1
No files found.
pkg/volume/cephfs/cephfs.go
View file @
763fd53a
...
@@ -239,7 +239,7 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
...
@@ -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
)
.
Info
f
(
"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 {
...
@@ -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
)
.
Info
f
(
"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 {
...
@@ -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
)
.
Info
f
(
"/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 {
...
@@ -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
)
.
Info
f
(
"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
)
...
...
pkg/volume/cephfs/cephfs_test.go
View file @
763fd53a
...
@@ -77,13 +77,13 @@ func TestPlugin(t *testing.T) {
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment