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
ee10b45c
Unverified
Commit
ee10b45c
authored
Jan 07, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72008 from oleksiys/master
Remove generic mount validation logic during unmount and rely on CSI driver
parents
5acac9b3
f6a0359c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
27 deletions
+3
-27
csi_mounter.go
pkg/volume/csi/csi_mounter.go
+3
-27
No files found.
pkg/volume/csi/csi_mounter.go
View file @
ee10b45c
...
...
@@ -33,7 +33,6 @@ import (
"k8s.io/kubernetes/pkg/features"
kstrings
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
//TODO (vladimirvivien) move this in a central loc later
...
...
@@ -289,20 +288,6 @@ func (c *csiMountMgr) TearDown() error {
func
(
c
*
csiMountMgr
)
TearDownAt
(
dir
string
)
error
{
klog
.
V
(
4
)
.
Infof
(
log
(
"Unmounter.TearDown(%s)"
,
dir
))
// is dir even mounted ?
// TODO (vladimirvivien) this check may not work for an emptyDir or local storage
// see https://github.com/kubernetes/kubernetes/pull/56836#discussion_r155834524
mounted
,
err
:=
isDirMounted
(
c
.
plugin
,
dir
)
if
err
!=
nil
{
klog
.
Error
(
log
(
"unmounter.Teardown failed while checking mount status for dir [%s]: %v"
,
dir
,
err
))
return
err
}
if
!
mounted
{
klog
.
V
(
4
)
.
Info
(
log
(
"unmounter.Teardown skipping unmount, dir not mounted [%s]"
,
dir
))
return
nil
}
volID
:=
c
.
volumeID
csi
:=
c
.
csiClient
...
...
@@ -319,7 +304,7 @@ func (c *csiMountMgr) TearDownAt(dir string) error {
klog
.
Error
(
log
(
"mounter.TearDownAt failed to clean mount dir [%s]: %v"
,
dir
,
err
))
return
err
}
klog
.
V
(
4
)
.
Infof
(
log
(
"mounte.TearDownAt successfully unmounted dir [%s]"
,
dir
))
klog
.
V
(
4
)
.
Infof
(
log
(
"mounte
r
.TearDownAt successfully unmounted dir [%s]"
,
dir
))
return
nil
}
...
...
@@ -375,21 +360,12 @@ func isDirMounted(plug *csiPlugin, dir string) (bool, error) {
// removeMountDir cleans the mount dir when dir is not mounted and removed the volume data file in dir
func
removeMountDir
(
plug
*
csiPlugin
,
mountPath
string
)
error
{
klog
.
V
(
4
)
.
Info
(
log
(
"removing mount path [%s]"
,
mountPath
))
if
pathExists
,
pathErr
:=
util
.
PathExists
(
mountPath
);
pathErr
!=
nil
{
klog
.
Error
(
log
(
"failed while checking mount path stat [%s]"
,
pathErr
))
return
pathErr
}
else
if
!
pathExists
{
klog
.
Warning
(
log
(
"skipping mount dir removal, path does not exist [%v]"
,
mountPath
))
return
nil
}
mounter
:=
plug
.
host
.
GetMounter
(
plug
.
GetPluginName
())
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
mountPath
)
mnt
,
err
:=
isDirMounted
(
plug
,
mountPath
)
if
err
!=
nil
{
klog
.
Error
(
log
(
"mount dir removal failed [%s]: %v"
,
mountPath
,
err
))
return
err
}
if
notM
nt
{
if
!
m
nt
{
klog
.
V
(
4
)
.
Info
(
log
(
"dir not mounted, deleting it [%s]"
,
mountPath
))
if
err
:=
os
.
Remove
(
mountPath
);
err
!=
nil
&&
!
os
.
IsNotExist
(
err
)
{
klog
.
Error
(
log
(
"failed to remove dir [%s]: %v"
,
mountPath
,
err
))
...
...
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