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
32766e3b
Commit
32766e3b
authored
Jan 11, 2017
by
rkouj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if path exists before performing unmount
parent
330c9227
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
0 deletions
+44
-0
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+8
-0
cinder.go
pkg/volume/cinder/cinder.go
+8
-0
BUILD
pkg/volume/fc/BUILD
+1
-0
fc.go
pkg/volume/fc/fc.go
+7
-0
BUILD
pkg/volume/flexvolume/BUILD
+1
-0
flexvolume.go
pkg/volume/flexvolume/flexvolume.go
+7
-0
iscsi.go
pkg/volume/iscsi/iscsi.go
+6
-0
rbd.go
pkg/volume/rbd/rbd.go
+6
-0
test_owners.csv
test/test_owners.csv
+0
-0
No files found.
pkg/volume/azure_dd/azure_dd.go
View file @
32766e3b
...
...
@@ -34,6 +34,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utilstrings
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -316,6 +317,13 @@ func (c *azureDiskUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
func
(
c
*
azureDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
notMnt
,
err
:=
c
.
mounter
.
IsLikelyNotMountPoint
(
dir
)
if
err
!=
nil
{
glog
.
Errorf
(
"Error checking if mountpoint %s: %v"
,
dir
,
err
)
...
...
pkg/volume/cinder/cinder.go
View file @
32766e3b
...
...
@@ -34,6 +34,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -386,6 +387,13 @@ func (c *cinderVolumeUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
func
(
c
*
cinderVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
glog
.
V
(
5
)
.
Infof
(
"Cinder TearDown of %s"
,
dir
)
notmnt
,
err
:=
c
.
mounter
.
IsLikelyNotMountPoint
(
dir
)
if
err
!=
nil
{
...
...
pkg/volume/fc/BUILD
View file @
32766e3b
...
...
@@ -23,6 +23,7 @@ go_library(
"//pkg/util/mount:go_default_library",
"//pkg/util/strings:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume/util:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:k8s.io/apimachinery/pkg/types",
],
...
...
pkg/volume/fc/fc.go
View file @
32766e3b
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -222,6 +223,12 @@ func (c *fcDiskUnmounter) TearDown() error {
}
func
(
c
*
fcDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
return
diskTearDown
(
c
.
manager
,
*
c
,
dir
,
c
.
mounter
)
}
...
...
pkg/volume/flexvolume/BUILD
View file @
32766e3b
...
...
@@ -21,6 +21,7 @@ go_library(
"//pkg/util/mount:go_default_library",
"//pkg/util/strings:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume/util:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
...
...
pkg/volume/flexvolume/flexvolume.go
View file @
32766e3b
...
...
@@ -32,6 +32,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
utilstrings
"k8s.io/kubernetes/pkg/util/strings"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -371,6 +372,12 @@ func (f *flexVolumeUnmounter) TearDown() error {
// TearDownAt simply deletes everything in the directory.
func
(
f
*
flexVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
notmnt
,
err
:=
f
.
mounter
.
IsLikelyNotMountPoint
(
dir
)
if
err
!=
nil
{
...
...
pkg/volume/iscsi/iscsi.go
View file @
32766e3b
...
...
@@ -230,6 +230,12 @@ func (c *iscsiDiskUnmounter) TearDown() error {
}
func
(
c
*
iscsiDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
ioutil
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
return
diskTearDown
(
c
.
manager
,
*
c
,
dir
,
c
.
mounter
)
}
...
...
pkg/volume/rbd/rbd.go
View file @
32766e3b
...
...
@@ -413,6 +413,12 @@ func (c *rbdUnmounter) TearDown() error {
}
func
(
c
*
rbdUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
volutil
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
glog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
}
return
diskTearDown
(
c
.
manager
,
*
c
,
dir
,
c
.
mounter
)
}
...
...
test/test_owners.csv
View file @
32766e3b
This diff is collapsed.
Click to expand it.
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