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
01b6fc78
Commit
01b6fc78
authored
Jun 28, 2017
by
zhangningmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the warning message if the rbd command is not found.
parent
11b5956f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
rbd_util.go
pkg/volume/rbd/rbd_util.go
+15
-4
No files found.
pkg/volume/rbd/rbd_util.go
View file @
01b6fc78
...
...
@@ -44,6 +44,7 @@ import (
const
(
imageWatcherStr
=
"watcher="
kubeLockMagic
=
"kubelet_lock_magic_"
rbdCmdErr
=
"executable file not found in $PATH"
)
// search /sys/bus for rbd device that matches given pool and image
...
...
@@ -103,6 +104,12 @@ type RBDUtil struct{}
func
(
util
*
RBDUtil
)
MakeGlobalPDName
(
rbd
rbd
)
string
{
return
makePDNameInternal
(
rbd
.
plugin
.
host
,
rbd
.
Pool
,
rbd
.
Image
)
}
func
rbdErrors
(
runErr
,
resultErr
error
)
error
{
if
runErr
.
Error
()
==
rbdCmdErr
{
return
fmt
.
Errorf
(
"rbd: rbd cmd not found"
)
}
return
resultErr
}
func
(
util
*
RBDUtil
)
rbdLock
(
b
rbdMounter
,
lock
bool
)
error
{
var
err
error
...
...
@@ -269,7 +276,7 @@ func (util *RBDUtil) AttachDisk(b rbdMounter) error {
// fence off other mappers
if
err
=
util
.
fencing
(
b
);
err
!=
nil
{
return
fmt
.
Errorf
(
"rbd: image %s is locked by other nodes"
,
b
.
Image
)
return
rbdErrors
(
err
,
fmt
.
Errorf
(
"rbd: failed to lock image %s (maybe locked by other nodes), error %v"
,
b
.
Image
,
err
)
)
}
// rbd lock remove needs ceph and image config
// but kubelet doesn't get them from apiserver during teardown
...
...
@@ -327,7 +334,7 @@ func (util *RBDUtil) DetachDisk(c rbdUnmounter, mntPath string) error {
// rbd unmap
_
,
err
=
c
.
plugin
.
execCommand
(
"rbd"
,
[]
string
{
"unmap"
,
device
})
if
err
!=
nil
{
return
fmt
.
Errorf
(
"rbd: failed to unmap device %s:Error: %v"
,
device
,
err
)
return
rbdErrors
(
err
,
fmt
.
Errorf
(
"rbd: failed to unmap device %s:Error: %v"
,
device
,
err
)
)
}
// load ceph and image/pool info to remove fencing
...
...
@@ -435,8 +442,12 @@ func (util *RBDUtil) rbdStatus(b *rbdMounter) (bool, error) {
output
=
string
(
cmd
)
if
err
!=
nil
{
// ignore error code, just checkout output for watcher string
glog
.
Warningf
(
"failed to execute rbd status on mon %s"
,
mon
)
if
err
.
Error
()
==
rbdCmdErr
{
glog
.
Errorf
(
"rbd cmd not found"
)
}
else
{
// ignore error code, just checkout output for watcher string
glog
.
Warningf
(
"failed to execute rbd status on mon %s"
,
mon
)
}
}
if
strings
.
Contains
(
output
,
imageWatcherStr
)
{
...
...
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