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
cc1be289
Unverified
Commit
cc1be289
authored
Jan 28, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72624 from danielqsj/clean_unmount
Cleanup callers of deprecated functions in volume/util
parents
035332f1
2426f0ee
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
65 additions
and
88 deletions
+65
-88
kubelet_getters.go
pkg/kubelet/kubelet_getters.go
+4
-4
attacher.go
pkg/volume/awsebs/attacher.go
+1
-1
aws_ebs.go
pkg/volume/awsebs/aws_ebs.go
+1
-1
aws_util.go
pkg/volume/awsebs/aws_util.go
+3
-2
attacher.go
pkg/volume/azure_dd/attacher.go
+1
-1
azure_mounter.go
pkg/volume/azure_dd/azure_mounter.go
+2
-1
azure_file.go
pkg/volume/azure_file/azure_file.go
+1
-1
cephfs.go
pkg/volume/cephfs/cephfs.go
+2
-2
attacher.go
pkg/volume/cinder/attacher.go
+2
-2
cinder.go
pkg/volume/cinder/cinder.go
+1
-1
empty_dir.go
pkg/volume/emptydir/empty_dir.go
+1
-1
attacher.go
pkg/volume/fc/attacher.go
+1
-1
fc.go
pkg/volume/fc/fc.go
+1
-1
fc_util.go
pkg/volume/fc/fc_util.go
+2
-1
detacher-defaults.go
pkg/volume/flexvolume/detacher-defaults.go
+2
-2
detacher.go
pkg/volume/flexvolume/detacher.go
+5
-5
unmounter-defaults.go
pkg/volume/flexvolume/unmounter-defaults.go
+2
-2
unmounter.go
pkg/volume/flexvolume/unmounter.go
+4
-4
flocker.go
pkg/volume/flocker/flocker.go
+1
-2
attacher.go
pkg/volume/gcepd/attacher.go
+2
-1
gce_pd.go
pkg/volume/gcepd/gce_pd.go
+1
-1
gce_util.go
pkg/volume/gcepd/gce_util.go
+2
-1
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+2
-2
iscsi.go
pkg/volume/iscsi/iscsi.go
+1
-1
iscsi_util.go
pkg/volume/iscsi/iscsi_util.go
+2
-2
local.go
pkg/volume/local/local.go
+2
-2
nfs.go
pkg/volume/nfs/nfs.go
+1
-1
attacher.go
pkg/volume/photon_pd/attacher.go
+2
-2
photon_pd.go
pkg/volume/photon_pd/photon_pd.go
+1
-1
photon_util.go
pkg/volume/photon_pd/photon_util.go
+2
-1
attacher.go
pkg/volume/rbd/attacher.go
+1
-1
rbd.go
pkg/volume/rbd/rbd.go
+1
-1
rbd_util.go
pkg/volume/rbd/rbd_util.go
+2
-2
sio_volume.go
pkg/volume/scaleio/sio_volume.go
+1
-1
storageos.go
pkg/volume/storageos/storageos.go
+1
-1
util.go
pkg/volume/util/util.go
+0
-29
attacher.go
pkg/volume/vsphere_volume/attacher.go
+1
-1
vsphere_volume.go
pkg/volume/vsphere_volume/vsphere_volume.go
+1
-1
vsphere_volume_util.go
pkg/volume/vsphere_volume/vsphere_volume_util.go
+2
-1
No files found.
pkg/kubelet/kubelet_getters.go
View file @
cc1be289
...
@@ -25,14 +25,14 @@ import (
...
@@ -25,14 +25,14 @@ import (
cadvisorapiv1
"github.com/google/cadvisor/info/v1"
cadvisorapiv1
"github.com/google/cadvisor/info/v1"
"k8s.io/klog"
"k8s.io/klog"
v1
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/kubelet/cm"
"k8s.io/kubernetes/pkg/kubelet/cm"
"k8s.io/kubernetes/pkg/kubelet/config"
"k8s.io/kubernetes/pkg/kubelet/config"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
utilfile
"k8s.io/kubernetes/pkg/util/file"
utilfile
"k8s.io/kubernetes/pkg/util/file"
"k8s.io/kubernetes/pkg/util/mount"
utilnode
"k8s.io/kubernetes/pkg/util/node"
utilnode
"k8s.io/kubernetes/pkg/util/node"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
// getRootDir returns the full path to the directory under which kubelet can
// getRootDir returns the full path to the directory under which kubelet can
...
@@ -278,7 +278,7 @@ func (kl *Kubelet) getPodVolumePathListFromDisk(podUID types.UID) ([]string, err
...
@@ -278,7 +278,7 @@ func (kl *Kubelet) getPodVolumePathListFromDisk(podUID types.UID) ([]string, err
volumes
:=
[]
string
{}
volumes
:=
[]
string
{}
podVolDir
:=
kl
.
getPodVolumesDir
(
podUID
)
podVolDir
:=
kl
.
getPodVolumesDir
(
podUID
)
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
podVolDir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
podVolDir
);
pathErr
!=
nil
{
return
volumes
,
fmt
.
Errorf
(
"Error checking if path %q exists: %v"
,
podVolDir
,
pathErr
)
return
volumes
,
fmt
.
Errorf
(
"Error checking if path %q exists: %v"
,
podVolDir
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Path %q does not exist"
,
podVolDir
)
klog
.
Warningf
(
"Path %q does not exist"
,
podVolDir
)
...
@@ -327,7 +327,7 @@ func (kl *Kubelet) getMountedVolumePathListFromDisk(podUID types.UID) ([]string,
...
@@ -327,7 +327,7 @@ func (kl *Kubelet) getMountedVolumePathListFromDisk(podUID types.UID) ([]string,
func
(
kl
*
Kubelet
)
podVolumeSubpathsDirExists
(
podUID
types
.
UID
)
(
bool
,
error
)
{
func
(
kl
*
Kubelet
)
podVolumeSubpathsDirExists
(
podUID
types
.
UID
)
(
bool
,
error
)
{
podVolDir
:=
kl
.
getPodVolumeSubpathsDir
(
podUID
)
podVolDir
:=
kl
.
getPodVolumeSubpathsDir
(
podUID
)
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
podVolDir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
podVolDir
);
pathErr
!=
nil
{
return
true
,
fmt
.
Errorf
(
"Error checking if path %q exists: %v"
,
podVolDir
,
pathErr
)
return
true
,
fmt
.
Errorf
(
"Error checking if path %q exists: %v"
,
podVolDir
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
return
false
,
nil
return
false
,
nil
...
...
pkg/volume/awsebs/attacher.go
View file @
cc1be289
...
@@ -274,7 +274,7 @@ func (detacher *awsElasticBlockStoreDetacher) Detach(volumeName string, nodeName
...
@@ -274,7 +274,7 @@ func (detacher *awsElasticBlockStoreDetacher) Detach(volumeName string, nodeName
}
}
func
(
detacher
*
awsElasticBlockStoreDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
awsElasticBlockStoreDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
mounter
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
setNodeDisk
(
func
setNodeDisk
(
...
...
pkg/volume/awsebs/aws_ebs.go
View file @
cc1be289
...
@@ -490,7 +490,7 @@ func (c *awsElasticBlockStoreUnmounter) TearDown() error {
...
@@ -490,7 +490,7 @@ func (c *awsElasticBlockStoreUnmounter) TearDown() error {
// Unmounts the bind mount
// Unmounts the bind mount
func
(
c
*
awsElasticBlockStoreUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
awsElasticBlockStoreUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
type
awsElasticBlockStoreDeleter
struct
{
type
awsElasticBlockStoreDeleter
struct
{
...
...
pkg/volume/awsebs/aws_util.go
View file @
cc1be289
...
@@ -31,6 +31,7 @@ import (
...
@@ -31,6 +31,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
cloudprovider
"k8s.io/cloud-provider"
cloudprovider
"k8s.io/cloud-provider"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -189,7 +190,7 @@ func populateVolumeOptions(pluginName, pvcName string, capacityGB resource.Quant
...
@@ -189,7 +190,7 @@ func populateVolumeOptions(pluginName, pvcName string, capacityGB resource.Quant
// Returns the first path that exists, or empty string if none exist.
// Returns the first path that exists, or empty string if none exist.
func
verifyDevicePath
(
devicePaths
[]
string
)
(
string
,
error
)
{
func
verifyDevicePath
(
devicePaths
[]
string
)
(
string
,
error
)
{
for
_
,
path
:=
range
devicePaths
{
for
_
,
path
:=
range
devicePaths
{
if
pathExists
,
err
:=
volumeutil
.
PathExists
(
path
);
err
!=
nil
{
if
pathExists
,
err
:=
mount
.
PathExists
(
path
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
}
else
if
pathExists
{
}
else
if
pathExists
{
return
path
,
nil
return
path
,
nil
...
@@ -203,7 +204,7 @@ func verifyDevicePath(devicePaths []string) (string, error) {
...
@@ -203,7 +204,7 @@ func verifyDevicePath(devicePaths []string) (string, error) {
func
verifyAllPathsRemoved
(
devicePaths
[]
string
)
(
bool
,
error
)
{
func
verifyAllPathsRemoved
(
devicePaths
[]
string
)
(
bool
,
error
)
{
allPathsRemoved
:=
true
allPathsRemoved
:=
true
for
_
,
path
:=
range
devicePaths
{
for
_
,
path
:=
range
devicePaths
{
exists
,
err
:=
volumeutil
.
PathExists
(
path
)
exists
,
err
:=
mount
.
PathExists
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
return
false
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
}
}
...
...
pkg/volume/azure_dd/attacher.go
View file @
cc1be289
...
@@ -309,7 +309,7 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro
...
@@ -309,7 +309,7 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro
// UnmountDevice unmounts the volume on the node
// UnmountDevice unmounts the volume on the node
func
(
detacher
*
azureDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
azureDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
err
:=
util
.
UnmountPath
(
deviceMountPath
,
detacher
.
plugin
.
host
.
GetMounter
(
detacher
.
plugin
.
GetPluginName
())
)
err
:=
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
plugin
.
host
.
GetMounter
(
detacher
.
plugin
.
GetPluginName
()),
false
)
if
err
==
nil
{
if
err
==
nil
{
klog
.
V
(
2
)
.
Infof
(
"azureDisk - Device %s was unmounted"
,
deviceMountPath
)
klog
.
V
(
2
)
.
Infof
(
"azureDisk - Device %s was unmounted"
,
deviceMountPath
)
}
else
{
}
else
{
...
...
pkg/volume/azure_dd/azure_mounter.go
View file @
cc1be289
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -172,7 +173,7 @@ func (u *azureDiskUnmounter) TearDown() error {
...
@@ -172,7 +173,7 @@ func (u *azureDiskUnmounter) TearDown() error {
}
}
func
(
u
*
azureDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
u
*
azureDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
...
...
pkg/volume/azure_file/azure_file.go
View file @
cc1be289
...
@@ -325,7 +325,7 @@ func (c *azureFileUnmounter) TearDown() error {
...
@@ -325,7 +325,7 @@ func (c *azureFileUnmounter) TearDown() error {
}
}
func
(
c
*
azureFileUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
azureFileUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
volutil
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
string
,
bool
,
error
)
{
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
string
,
bool
,
error
)
{
...
...
pkg/volume/cephfs/cephfs.go
View file @
cc1be289
...
@@ -264,7 +264,7 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
...
@@ -264,7 +264,7 @@ func (cephfsVolume *cephfsMounter) SetUpAt(dir string, fsGroup *int64) error {
err
=
cephfsVolume
.
execMount
(
dir
)
err
=
cephfsVolume
.
execMount
(
dir
)
if
err
!=
nil
{
if
err
!=
nil
{
// cleanup upon failure.
// cleanup upon failure.
util
.
UnmountPath
(
dir
,
cephfsVolume
.
mounter
)
mount
.
CleanupMountPoint
(
dir
,
cephfsVolume
.
mounter
,
false
)
return
err
return
err
}
}
return
nil
return
nil
...
@@ -283,7 +283,7 @@ func (cephfsVolume *cephfsUnmounter) TearDown() error {
...
@@ -283,7 +283,7 @@ func (cephfsVolume *cephfsUnmounter) TearDown() error {
// TearDownAt unmounts the bind mount
// TearDownAt unmounts the bind mount
func
(
cephfsVolume
*
cephfsUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
cephfsVolume
*
cephfsUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
cephfsVolume
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
cephfsVolume
.
mounter
,
false
)
}
}
// GetPath creates global mount path
// GetPath creates global mount path
...
...
pkg/volume/cinder/attacher.go
View file @
cc1be289
...
@@ -237,7 +237,7 @@ func (attacher *cinderDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath
...
@@ -237,7 +237,7 @@ func (attacher *cinderDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath
// Using the Cinder volume ID, find the real device path (See Issue #33128)
// Using the Cinder volume ID, find the real device path (See Issue #33128)
devicePath
=
attacher
.
cinderProvider
.
GetDevicePath
(
volumeID
)
devicePath
=
attacher
.
cinderProvider
.
GetDevicePath
(
volumeID
)
}
}
exists
,
err
:=
volumeutil
.
PathExists
(
devicePath
)
exists
,
err
:=
mount
.
PathExists
(
devicePath
)
if
exists
&&
err
==
nil
{
if
exists
&&
err
==
nil
{
klog
.
Infof
(
"Successfully found attached Cinder disk %q at %v."
,
volumeID
,
devicePath
)
klog
.
Infof
(
"Successfully found attached Cinder disk %q at %v."
,
volumeID
,
devicePath
)
return
devicePath
,
nil
return
devicePath
,
nil
...
@@ -403,7 +403,7 @@ func (detacher *cinderDiskDetacher) Detach(volumeName string, nodeName types.Nod
...
@@ -403,7 +403,7 @@ func (detacher *cinderDiskDetacher) Detach(volumeName string, nodeName types.Nod
}
}
func
(
detacher
*
cinderDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
cinderDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
mounter
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
(
attacher
*
cinderDiskAttacher
)
nodeInstanceID
(
nodeName
types
.
NodeName
)
(
string
,
error
)
{
func
(
attacher
*
cinderDiskAttacher
)
nodeInstanceID
(
nodeName
types
.
NodeName
)
(
string
,
error
)
{
...
...
pkg/volume/cinder/cinder.go
View file @
cc1be289
...
@@ -459,7 +459,7 @@ func (c *cinderVolumeUnmounter) TearDown() error {
...
@@ -459,7 +459,7 @@ func (c *cinderVolumeUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
// resource was the last reference to that disk on the kubelet.
func
(
c
*
cinderVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
cinderVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
...
...
pkg/volume/emptydir/empty_dir.go
View file @
cc1be289
...
@@ -371,7 +371,7 @@ func (ed *emptyDir) TearDown() error {
...
@@ -371,7 +371,7 @@ func (ed *emptyDir) TearDown() error {
// TearDownAt simply discards everything in the directory.
// TearDownAt simply discards everything in the directory.
func
(
ed
*
emptyDir
)
TearDownAt
(
dir
string
)
error
{
func
(
ed
*
emptyDir
)
TearDownAt
(
dir
string
)
error
{
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
dir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
...
...
pkg/volume/fc/attacher.go
View file @
cc1be289
...
@@ -162,7 +162,7 @@ func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error {
...
@@ -162,7 +162,7 @@ func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error {
return
err
return
err
}
}
// Unmount for deviceMountPath(=globalPDPath)
// Unmount for deviceMountPath(=globalPDPath)
err
=
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
mounter
)
err
=
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"fc: failed to unmount: %s
\n
Error: %v"
,
deviceMountPath
,
err
)
return
fmt
.
Errorf
(
"fc: failed to unmount: %s
\n
Error: %v"
,
deviceMountPath
,
err
)
}
}
...
...
pkg/volume/fc/fc.go
View file @
cc1be289
...
@@ -431,7 +431,7 @@ func (c *fcDiskUnmounter) TearDown() error {
...
@@ -431,7 +431,7 @@ func (c *fcDiskUnmounter) TearDown() error {
}
}
func
(
c
*
fcDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
fcDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
// Block Volumes Support
// Block Volumes Support
...
...
pkg/volume/fc/fc_util.go
View file @
cc1be289
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
utilfeature
"k8s.io/apiserver/pkg/util/feature"
utilfeature
"k8s.io/apiserver/pkg/util/feature"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -375,7 +376,7 @@ func (util *fcUtil) DetachBlockFCDisk(c fcDiskUnmapper, mapPath, devicePath stri
...
@@ -375,7 +376,7 @@ func (util *fcUtil) DetachBlockFCDisk(c fcDiskUnmapper, mapPath, devicePath stri
}
}
func
checkPathExists
(
path
string
)
(
bool
,
error
)
{
func
checkPathExists
(
path
string
)
(
bool
,
error
)
{
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
path
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
path
);
pathErr
!=
nil
{
return
pathExists
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
pathExists
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
path
)
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
path
)
...
...
pkg/volume/flexvolume/detacher-defaults.go
View file @
cc1be289
...
@@ -21,7 +21,7 @@ import (
...
@@ -21,7 +21,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/
volume/util
"
"k8s.io/kubernetes/pkg/
util/mount
"
)
)
type
detacherDefaults
flexVolumeDetacher
type
detacherDefaults
flexVolumeDetacher
...
@@ -41,5 +41,5 @@ func (d *detacherDefaults) WaitForDetach(devicePath string, timeout time.Duratio
...
@@ -41,5 +41,5 @@ func (d *detacherDefaults) WaitForDetach(devicePath string, timeout time.Duratio
// UnmountDevice is part of the volume.Detacher interface.
// UnmountDevice is part of the volume.Detacher interface.
func
(
d
*
detacherDefaults
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
d
*
detacherDefaults
)
UnmountDevice
(
deviceMountPath
string
)
error
{
klog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default UnmountDevice for device mount path "
,
deviceMountPath
)
klog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default UnmountDevice for device mount path "
,
deviceMountPath
)
return
util
.
UnmountPath
(
deviceMountPath
,
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
())
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
()),
false
)
}
}
pkg/volume/flexvolume/detacher.go
View file @
cc1be289
...
@@ -22,8 +22,8 @@ import (
...
@@ -22,8 +22,8 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
)
)
type
flexVolumeDetacher
struct
{
type
flexVolumeDetacher
struct
{
...
@@ -51,18 +51,18 @@ func (d *flexVolumeDetacher) Detach(volumeName string, hostName types.NodeName)
...
@@ -51,18 +51,18 @@ func (d *flexVolumeDetacher) Detach(volumeName string, hostName types.NodeName)
// UnmountDevice is part of the volume.Detacher interface.
// UnmountDevice is part of the volume.Detacher interface.
func
(
d
*
flexVolumeDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
d
*
flexVolumeDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
pathExists
,
pathErr
:=
util
.
PathExists
(
deviceMountPath
)
pathExists
,
pathErr
:=
mount
.
PathExists
(
deviceMountPath
)
if
!
pathExists
{
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
deviceMountPath
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
deviceMountPath
)
return
nil
return
nil
}
}
if
pathErr
!=
nil
&&
!
util
.
IsCorruptedMnt
(
pathErr
)
{
if
pathErr
!=
nil
&&
!
mount
.
IsCorruptedMnt
(
pathErr
)
{
return
fmt
.
Errorf
(
"Error checking path: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking path: %v"
,
pathErr
)
}
}
notmnt
,
err
:=
isNotMounted
(
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
()),
deviceMountPath
)
notmnt
,
err
:=
isNotMounted
(
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
()),
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
util
.
IsCorruptedMnt
(
err
)
{
if
mount
.
IsCorruptedMnt
(
err
)
{
notmnt
=
false
// Corrupted error is assumed to be mounted.
notmnt
=
false
// Corrupted error is assumed to be mounted.
}
else
{
}
else
{
return
err
return
err
...
@@ -85,7 +85,7 @@ func (d *flexVolumeDetacher) UnmountDevice(deviceMountPath string) error {
...
@@ -85,7 +85,7 @@ func (d *flexVolumeDetacher) UnmountDevice(deviceMountPath string) error {
}
}
// Flexvolume driver may remove the directory. Ignore if it does.
// Flexvolume driver may remove the directory. Ignore if it does.
if
pathExists
,
pathErr
:=
util
.
PathExists
(
deviceMountPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
deviceMountPath
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
return
nil
return
nil
...
...
pkg/volume/flexvolume/unmounter-defaults.go
View file @
cc1be289
...
@@ -18,12 +18,12 @@ package flexvolume
...
@@ -18,12 +18,12 @@ package flexvolume
import
(
import
(
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/
volume/util
"
"k8s.io/kubernetes/pkg/
util/mount
"
)
)
type
unmounterDefaults
flexVolumeUnmounter
type
unmounterDefaults
flexVolumeUnmounter
func
(
f
*
unmounterDefaults
)
TearDownAt
(
dir
string
)
error
{
func
(
f
*
unmounterDefaults
)
TearDownAt
(
dir
string
)
error
{
klog
.
Warning
(
logPrefix
(
f
.
plugin
),
"using default TearDownAt for "
,
dir
)
klog
.
Warning
(
logPrefix
(
f
.
plugin
),
"using default TearDownAt for "
,
dir
)
return
util
.
UnmountPath
(
dir
,
f
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
f
.
mounter
,
false
)
}
}
pkg/volume/flexvolume/unmounter.go
View file @
cc1be289
...
@@ -21,8 +21,8 @@ import (
...
@@ -21,8 +21,8 @@ import (
"os"
"os"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
"k8s.io/utils/exec"
)
)
...
@@ -43,13 +43,13 @@ func (f *flexVolumeUnmounter) TearDown() error {
...
@@ -43,13 +43,13 @@ func (f *flexVolumeUnmounter) TearDown() error {
func
(
f
*
flexVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
f
*
flexVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
)
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
)
if
!
pathExists
{
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
return
nil
return
nil
}
}
if
pathErr
!=
nil
&&
!
util
.
IsCorruptedMnt
(
pathErr
)
{
if
pathErr
!=
nil
&&
!
mount
.
IsCorruptedMnt
(
pathErr
)
{
return
fmt
.
Errorf
(
"Error checking path: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking path: %v"
,
pathErr
)
}
}
...
@@ -64,7 +64,7 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error {
...
@@ -64,7 +64,7 @@ func (f *flexVolumeUnmounter) TearDownAt(dir string) error {
}
}
// Flexvolume driver may remove the directory. Ignore if it does.
// Flexvolume driver may remove the directory. Ignore if it does.
if
pathExists
,
pathErr
:=
util
.
PathExists
(
dir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
return
nil
return
nil
...
...
pkg/volume/flocker/flocker.go
View file @
cc1be289
...
@@ -31,7 +31,6 @@ import (
...
@@ -31,7 +31,6 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
flockerapi
"github.com/clusterhq/flocker-go"
flockerapi
"github.com/clusterhq/flocker-go"
"k8s.io/kubernetes/pkg/volume/util"
)
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
@@ -434,7 +433,7 @@ func (c *flockerVolumeUnmounter) TearDown() error {
...
@@ -434,7 +433,7 @@ func (c *flockerVolumeUnmounter) TearDown() error {
// TearDownAt unmounts the bind mount
// TearDownAt unmounts the bind mount
func
(
c
*
flockerVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
flockerVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
func
(
p
*
flockerPlugin
)
NewDeleter
(
spec
*
volume
.
Spec
)
(
volume
.
Deleter
,
error
)
{
func
(
p
*
flockerPlugin
)
NewDeleter
(
spec
*
volume
.
Spec
)
(
volume
.
Deleter
,
error
)
{
...
...
pkg/volume/gcepd/attacher.go
View file @
cc1be289
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +29,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -285,5 +286,5 @@ func (detacher *gcePersistentDiskDetacher) Detach(volumeName string, nodeName ty
...
@@ -285,5 +286,5 @@ func (detacher *gcePersistentDiskDetacher) Detach(volumeName string, nodeName ty
}
}
func
(
detacher
*
gcePersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
gcePersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
)
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
),
false
)
}
}
pkg/volume/gcepd/gce_pd.go
View file @
cc1be289
...
@@ -459,7 +459,7 @@ func (c *gcePersistentDiskUnmounter) TearDown() error {
...
@@ -459,7 +459,7 @@ func (c *gcePersistentDiskUnmounter) TearDown() error {
// TearDownAt unmounts the bind mount
// TearDownAt unmounts the bind mount
func
(
c
*
gcePersistentDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
gcePersistentDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
type
gcePersistentDiskDeleter
struct
{
type
gcePersistentDiskDeleter
struct
{
...
...
pkg/volume/gcepd/gce_util.go
View file @
cc1be289
...
@@ -33,6 +33,7 @@ import (
...
@@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/features"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
kubeletapis
"k8s.io/kubernetes/pkg/kubelet/apis"
utilfile
"k8s.io/kubernetes/pkg/util/file"
utilfile
"k8s.io/kubernetes/pkg/util/file"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
"k8s.io/utils/exec"
...
@@ -207,7 +208,7 @@ func verifyDevicePath(devicePaths []string, sdBeforeSet sets.String, diskName st
...
@@ -207,7 +208,7 @@ func verifyDevicePath(devicePaths []string, sdBeforeSet sets.String, diskName st
}
}
for
_
,
path
:=
range
devicePaths
{
for
_
,
path
:=
range
devicePaths
{
if
pathExists
,
err
:=
volumeutil
.
PathExists
(
path
);
err
!=
nil
{
if
pathExists
,
err
:=
mount
.
PathExists
(
path
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
}
else
if
pathExists
{
}
else
if
pathExists
{
// validate that the path actually resolves to the correct disk
// validate that the path actually resolves to the correct disk
...
...
pkg/volume/glusterfs/glusterfs.go
View file @
cc1be289
...
@@ -295,7 +295,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error {
...
@@ -295,7 +295,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error {
}
}
// Cleanup upon failure.
// Cleanup upon failure.
volutil
.
UnmountPath
(
dir
,
b
.
mounter
)
mount
.
CleanupMountPoint
(
dir
,
b
.
mounter
,
false
)
return
err
return
err
}
}
...
@@ -315,7 +315,7 @@ func (c *glusterfsUnmounter) TearDown() error {
...
@@ -315,7 +315,7 @@ func (c *glusterfsUnmounter) TearDown() error {
}
}
func
(
c
*
glusterfsUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
glusterfsUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
volutil
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
func
(
b
*
glusterfsMounter
)
setUpAtInternal
(
dir
string
)
error
{
func
(
b
*
glusterfsMounter
)
setUpAtInternal
(
dir
string
)
error
{
...
...
pkg/volume/iscsi/iscsi.go
View file @
cc1be289
...
@@ -359,7 +359,7 @@ func (c *iscsiDiskUnmounter) TearDown() error {
...
@@ -359,7 +359,7 @@ func (c *iscsiDiskUnmounter) TearDown() error {
}
}
func
(
c
*
iscsiDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
iscsiDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
ioutil
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
// Block Volumes Support
// Block Volumes Support
...
...
pkg/volume/iscsi/iscsi_util.go
View file @
cc1be289
...
@@ -590,7 +590,7 @@ func deleteDevices(c iscsiDiskUnmounter) error {
...
@@ -590,7 +590,7 @@ func deleteDevices(c iscsiDiskUnmounter) error {
// DetachDisk unmounts and detaches a volume from node
// DetachDisk unmounts and detaches a volume from node
func
(
util
*
ISCSIUtil
)
DetachDisk
(
c
iscsiDiskUnmounter
,
mntPath
string
)
error
{
func
(
util
*
ISCSIUtil
)
DetachDisk
(
c
iscsiDiskUnmounter
,
mntPath
string
)
error
{
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
mntPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
mntPath
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
mntPath
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
mntPath
)
...
@@ -667,7 +667,7 @@ func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, mntPath string) error {
...
@@ -667,7 +667,7 @@ func (util *ISCSIUtil) DetachDisk(c iscsiDiskUnmounter, mntPath string) error {
// DetachBlockISCSIDisk removes loopback device for a volume and detaches a volume from node
// DetachBlockISCSIDisk removes loopback device for a volume and detaches a volume from node
func
(
util
*
ISCSIUtil
)
DetachBlockISCSIDisk
(
c
iscsiDiskUnmapper
,
mapPath
string
)
error
{
func
(
util
*
ISCSIUtil
)
DetachBlockISCSIDisk
(
c
iscsiDiskUnmapper
,
mapPath
string
)
error
{
if
pathExists
,
pathErr
:=
volumeutil
.
PathExists
(
mapPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
mapPath
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
mapPath
)
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
mapPath
)
...
...
pkg/volume/local/local.go
View file @
cc1be289
...
@@ -371,7 +371,7 @@ func (dm *deviceMounter) UnmountDevice(deviceMountPath string) error {
...
@@ -371,7 +371,7 @@ func (dm *deviceMounter) UnmountDevice(deviceMountPath string) error {
// has base mount path: /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts
// has base mount path: /var/lib/kubelet/plugins/kubernetes.io/local-volume/mounts
basemountPath
:=
dm
.
plugin
.
generateBlockDeviceBaseGlobalPath
()
basemountPath
:=
dm
.
plugin
.
generateBlockDeviceBaseGlobalPath
()
if
mount
.
PathWithinBase
(
deviceMountPath
,
basemountPath
)
{
if
mount
.
PathWithinBase
(
deviceMountPath
,
basemountPath
)
{
return
util
.
UnmountPath
(
deviceMountPath
,
dm
.
mounter
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
dm
.
mounter
,
false
)
}
}
return
nil
return
nil
...
@@ -546,7 +546,7 @@ func (u *localVolumeUnmounter) TearDown() error {
...
@@ -546,7 +546,7 @@ func (u *localVolumeUnmounter) TearDown() error {
// TearDownAt unmounts the bind mount
// TearDownAt unmounts the bind mount
func
(
u
*
localVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
u
*
localVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
klog
.
V
(
4
)
.
Infof
(
"Unmounting volume %q at path %q
\n
"
,
u
.
volName
,
dir
)
klog
.
V
(
4
)
.
Infof
(
"Unmounting volume %q at path %q
\n
"
,
u
.
volName
,
dir
)
return
util
.
Unmount
MountPoint
(
dir
,
u
.
mounter
,
true
)
/* extensiveMountPointCheck = true */
return
mount
.
Cleanup
MountPoint
(
dir
,
u
.
mounter
,
true
)
/* extensiveMountPointCheck = true */
}
}
// localVolumeMapper implements the BlockVolumeMapper interface for local volumes.
// localVolumeMapper implements the BlockVolumeMapper interface for local volumes.
...
...
pkg/volume/nfs/nfs.go
View file @
cc1be289
...
@@ -298,7 +298,7 @@ func (c *nfsUnmounter) TearDownAt(dir string) error {
...
@@ -298,7 +298,7 @@ func (c *nfsUnmounter) TearDownAt(dir string) error {
// Use extensiveMountPointCheck to consult /proc/mounts. We can't use faster
// Use extensiveMountPointCheck to consult /proc/mounts. We can't use faster
// IsLikelyNotMountPoint (lstat()), since there may be root_squash on the
// IsLikelyNotMountPoint (lstat()), since there may be root_squash on the
// NFS server and kubelet may not be able to do lstat/stat() there.
// NFS server and kubelet may not be able to do lstat/stat() there.
return
util
.
Unmount
MountPoint
(
dir
,
c
.
mounter
,
true
/* extensiveMountPointCheck */
)
return
mount
.
Cleanup
MountPoint
(
dir
,
c
.
mounter
,
true
/* extensiveMountPointCheck */
)
}
}
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
NFSVolumeSource
,
bool
,
error
)
{
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
NFSVolumeSource
,
bool
,
error
)
{
...
...
pkg/volume/photon_pd/attacher.go
View file @
cc1be289
...
@@ -293,7 +293,7 @@ func (detacher *photonPersistentDiskDetacher) WaitForDetach(devicePath string, t
...
@@ -293,7 +293,7 @@ func (detacher *photonPersistentDiskDetacher) WaitForDetach(devicePath string, t
select
{
select
{
case
<-
ticker
.
C
:
case
<-
ticker
.
C
:
klog
.
V
(
4
)
.
Infof
(
"Checking device %q is detached."
,
devicePath
)
klog
.
V
(
4
)
.
Infof
(
"Checking device %q is detached."
,
devicePath
)
if
pathExists
,
err
:=
volumeutil
.
PathExists
(
devicePath
);
err
!=
nil
{
if
pathExists
,
err
:=
mount
.
PathExists
(
devicePath
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if device path exists: %v"
,
err
)
return
fmt
.
Errorf
(
"Error checking if device path exists: %v"
,
err
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
return
nil
return
nil
...
@@ -305,5 +305,5 @@ func (detacher *photonPersistentDiskDetacher) WaitForDetach(devicePath string, t
...
@@ -305,5 +305,5 @@ func (detacher *photonPersistentDiskDetacher) WaitForDetach(devicePath string, t
}
}
func
(
detacher
*
photonPersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
photonPersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
mounter
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
pkg/volume/photon_pd/photon_pd.go
View file @
cc1be289
...
@@ -281,7 +281,7 @@ func (c *photonPersistentDiskUnmounter) TearDown() error {
...
@@ -281,7 +281,7 @@ func (c *photonPersistentDiskUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
// resource was the last reference to that disk on the kubelet.
func
(
c
*
photonPersistentDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
photonPersistentDiskUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
c
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
c
.
mounter
,
false
)
}
}
func
makeGlobalPDPath
(
host
volume
.
VolumeHost
,
devName
string
)
string
{
func
makeGlobalPDPath
(
host
volume
.
VolumeHost
,
devName
string
)
string
{
...
...
pkg/volume/photon_pd/photon_util.go
View file @
cc1be289
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
cloudprovider
"k8s.io/cloud-provider"
cloudprovider
"k8s.io/cloud-provider"
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/cloudprovider/providers/photon"
"k8s.io/kubernetes/pkg/cloudprovider/providers/photon"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -69,7 +70,7 @@ func scsiHostScan() {
...
@@ -69,7 +70,7 @@ func scsiHostScan() {
}
}
func
verifyDevicePath
(
path
string
)
(
string
,
error
)
{
func
verifyDevicePath
(
path
string
)
(
string
,
error
)
{
if
pathExists
,
err
:=
volumeutil
.
PathExists
(
path
);
err
!=
nil
{
if
pathExists
,
err
:=
mount
.
PathExists
(
path
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
}
else
if
pathExists
{
}
else
if
pathExists
{
return
path
,
nil
return
path
,
nil
...
...
pkg/volume/rbd/attacher.go
View file @
cc1be289
...
@@ -197,7 +197,7 @@ var _ volume.DeviceUnmounter = &rbdDetacher{}
...
@@ -197,7 +197,7 @@ var _ volume.DeviceUnmounter = &rbdDetacher{}
// - Remove the deviceMountPath at last.
// - Remove the deviceMountPath at last.
// This method is idempotent, callers are responsible for retrying on failure.
// This method is idempotent, callers are responsible for retrying on failure.
func
(
detacher
*
rbdDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
rbdDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
if
pathExists
,
pathErr
:=
volutil
.
PathExists
(
deviceMountPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
deviceMountPath
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
deviceMountPath
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
deviceMountPath
)
...
...
pkg/volume/rbd/rbd.go
View file @
cc1be289
...
@@ -852,7 +852,7 @@ func (c *rbdUnmounter) TearDown() error {
...
@@ -852,7 +852,7 @@ func (c *rbdUnmounter) TearDown() error {
func
(
c
*
rbdUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
c
*
rbdUnmounter
)
TearDownAt
(
dir
string
)
error
{
klog
.
V
(
4
)
.
Infof
(
"rbd: attempting to teardown at %s"
,
dir
)
klog
.
V
(
4
)
.
Infof
(
"rbd: attempting to teardown at %s"
,
dir
)
if
pathExists
,
pathErr
:=
volutil
.
PathExists
(
dir
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
dir
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
klog
.
Warningf
(
"Warning: Unmount skipped because path does not exist: %v"
,
dir
)
...
...
pkg/volume/rbd/rbd_util.go
View file @
cc1be289
...
@@ -363,7 +363,7 @@ func (util *RBDUtil) AttachDisk(b rbdMounter) (string, error) {
...
@@ -363,7 +363,7 @@ func (util *RBDUtil) AttachDisk(b rbdMounter) (string, error) {
var
output
[]
byte
var
output
[]
byte
globalPDPath
:=
util
.
MakeGlobalPDName
(
*
b
.
rbd
)
globalPDPath
:=
util
.
MakeGlobalPDName
(
*
b
.
rbd
)
if
pathExists
,
pathErr
:=
volutil
.
PathExists
(
globalPDPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
globalPDPath
);
pathErr
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
if
err
:=
os
.
MkdirAll
(
globalPDPath
,
0750
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
globalPDPath
,
0750
);
err
!=
nil
{
...
@@ -505,7 +505,7 @@ func (util *RBDUtil) DetachDisk(plugin *rbdPlugin, deviceMountPath string, devic
...
@@ -505,7 +505,7 @@ func (util *RBDUtil) DetachDisk(plugin *rbdPlugin, deviceMountPath string, devic
// DetachBlockDisk detaches the disk from the node.
// DetachBlockDisk detaches the disk from the node.
func
(
util
*
RBDUtil
)
DetachBlockDisk
(
disk
rbdDiskUnmapper
,
mapPath
string
)
error
{
func
(
util
*
RBDUtil
)
DetachBlockDisk
(
disk
rbdDiskUnmapper
,
mapPath
string
)
error
{
if
pathExists
,
pathErr
:=
volutil
.
PathExists
(
mapPath
);
pathErr
!=
nil
{
if
pathExists
,
pathErr
:=
mount
.
PathExists
(
mapPath
);
pathErr
!=
nil
{
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
return
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
pathErr
)
}
else
if
!
pathExists
{
}
else
if
!
pathExists
{
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
mapPath
)
klog
.
Warningf
(
"Warning: Unmap skipped because path does not exist: %v"
,
mapPath
)
...
...
pkg/volume/scaleio/sio_volume.go
View file @
cc1be289
...
@@ -193,7 +193,7 @@ func (v *sioVolume) TearDownAt(dir string) error {
...
@@ -193,7 +193,7 @@ func (v *sioVolume) TearDownAt(dir string) error {
}
}
klog
.
V
(
4
)
.
Info
(
log
(
"attempting to unmount %s"
,
dir
))
klog
.
V
(
4
)
.
Info
(
log
(
"attempting to unmount %s"
,
dir
))
if
err
:=
util
.
UnmountPath
(
dir
,
mounter
);
err
!=
nil
{
if
err
:=
mount
.
CleanupMountPoint
(
dir
,
mounter
,
false
);
err
!=
nil
{
klog
.
Error
(
log
(
"teardown failed while unmounting dir %s: %v "
,
dir
,
err
))
klog
.
Error
(
log
(
"teardown failed while unmounting dir %s: %v "
,
dir
,
err
))
return
err
return
err
}
}
...
...
pkg/volume/storageos/storageos.go
View file @
cc1be289
...
@@ -533,7 +533,7 @@ func (b *storageosUnmounter) TearDown() error {
...
@@ -533,7 +533,7 @@ func (b *storageosUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
// resource was the last reference to that disk on the kubelet.
func
(
b
*
storageosUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
b
*
storageosUnmounter
)
TearDownAt
(
dir
string
)
error
{
if
err
:=
util
.
UnmountPath
(
dir
,
b
.
mounter
);
err
!=
nil
{
if
err
:=
mount
.
CleanupMountPoint
(
dir
,
b
.
mounter
,
false
);
err
!=
nil
{
klog
.
V
(
4
)
.
Infof
(
"Unmounted StorageOS volume %s failed with: %v"
,
b
.
pvName
,
err
)
klog
.
V
(
4
)
.
Infof
(
"Unmounted StorageOS volume %s failed with: %v"
,
b
.
pvName
,
err
)
}
}
if
err
:=
b
.
manager
.
UnmountVolume
(
b
);
err
!=
nil
{
if
err
:=
b
.
manager
.
UnmountVolume
(
b
);
err
!=
nil
{
...
...
pkg/volume/util/util.go
View file @
cc1be289
...
@@ -125,35 +125,6 @@ func SetReady(dir string) {
...
@@ -125,35 +125,6 @@ func SetReady(dir string) {
file
.
Close
()
file
.
Close
()
}
}
// UnmountPath is a common unmount routine that unmounts the given path and
// deletes the remaining directory if successful.
// TODO: Remove this function and change callers to call mount pkg directly
func
UnmountPath
(
mountPath
string
,
mounter
mount
.
Interface
)
error
{
return
mount
.
CleanupMountPoint
(
mountPath
,
mounter
,
false
/* extensiveMountPointCheck */
)
}
// UnmountMountPoint is a common unmount routine that unmounts the given path and
// deletes the remaining directory if successful.
// if extensiveMountPointCheck is true
// IsNotMountPoint will be called instead of IsLikelyNotMountPoint.
// IsNotMountPoint is more expensive but properly handles bind mounts.
// TODO: Change callers to call mount pkg directly
func
UnmountMountPoint
(
mountPath
string
,
mounter
mount
.
Interface
,
extensiveMountPointCheck
bool
)
error
{
return
mount
.
CleanupMountPoint
(
mountPath
,
mounter
,
extensiveMountPointCheck
)
}
// PathExists returns true if the specified path exists.
// TODO: Change callers to call mount pkg directly
func
PathExists
(
path
string
)
(
bool
,
error
)
{
return
mount
.
PathExists
(
path
)
}
// IsCorruptedMnt return true if err is about corrupted mount point
// TODO: Change callers to call mount pkg directly
func
IsCorruptedMnt
(
err
error
)
bool
{
return
mount
.
IsCorruptedMnt
(
err
)
}
// GetSecretForPod locates secret by name in the pod's namespace and returns secret map
// GetSecretForPod locates secret by name in the pod's namespace and returns secret map
func
GetSecretForPod
(
pod
*
v1
.
Pod
,
secretName
string
,
kubeClient
clientset
.
Interface
)
(
map
[
string
]
string
,
error
)
{
func
GetSecretForPod
(
pod
*
v1
.
Pod
,
secretName
string
,
kubeClient
clientset
.
Interface
)
(
map
[
string
]
string
,
error
)
{
secret
:=
make
(
map
[
string
]
string
)
secret
:=
make
(
map
[
string
]
string
)
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
cc1be289
...
@@ -292,7 +292,7 @@ func (detacher *vsphereVMDKDetacher) Detach(volumeName string, nodeName types.No
...
@@ -292,7 +292,7 @@ func (detacher *vsphereVMDKDetacher) Detach(volumeName string, nodeName types.No
}
}
func
(
detacher
*
vsphereVMDKDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
vsphereVMDKDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
mounter
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
setNodeVolume
(
func
setNodeVolume
(
...
...
pkg/volume/vsphere_volume/vsphere_volume.go
View file @
cc1be289
...
@@ -289,7 +289,7 @@ func (v *vsphereVolumeUnmounter) TearDown() error {
...
@@ -289,7 +289,7 @@ func (v *vsphereVolumeUnmounter) TearDown() error {
// Unmounts the bind mount, and detaches the disk only if the PD
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
// resource was the last reference to that disk on the kubelet.
func
(
v
*
vsphereVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
func
(
v
*
vsphereVolumeUnmounter
)
TearDownAt
(
dir
string
)
error
{
return
util
.
UnmountPath
(
dir
,
v
.
mounter
)
return
mount
.
CleanupMountPoint
(
dir
,
v
.
mounter
,
false
)
}
}
func
makeGlobalPDPath
(
host
volume
.
VolumeHost
,
devName
string
)
string
{
func
makeGlobalPDPath
(
host
volume
.
VolumeHost
,
devName
string
)
string
{
...
...
pkg/volume/vsphere_volume/vsphere_volume_util.go
View file @
cc1be289
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
)
)
...
@@ -73,7 +74,7 @@ type VolumeSpec struct {
...
@@ -73,7 +74,7 @@ type VolumeSpec struct {
}
}
func
verifyDevicePath
(
path
string
)
(
string
,
error
)
{
func
verifyDevicePath
(
path
string
)
(
string
,
error
)
{
if
pathExists
,
err
:=
volumeutil
.
PathExists
(
path
);
err
!=
nil
{
if
pathExists
,
err
:=
mount
.
PathExists
(
path
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
return
""
,
fmt
.
Errorf
(
"Error checking if path exists: %v"
,
err
)
}
else
if
pathExists
{
}
else
if
pathExists
{
return
path
,
nil
return
path
,
nil
...
...
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