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
bc0e170d
Commit
bc0e170d
authored
Aug 14, 2017
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add pluginName to VolumeHost.GetMouter
Different plugins can get different mounter, depending where the mount utilities are.
parent
282404cb
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
86 additions
and
86 deletions
+86
-86
attach_detach_controller.go
...ontroller/volume/attachdetach/attach_detach_controller.go
+1
-1
volume_host.go
pkg/controller/volume/persistentvolume/volume_host.go
+1
-1
volume_host.go
pkg/kubelet/volume_host.go
+1
-1
attacher.go
pkg/volume/aws_ebs/attacher.go
+3
-3
aws_ebs.go
pkg/volume/aws_ebs/aws_ebs.go
+4
-4
attacher.go
pkg/volume/azure_dd/attacher.go
+2
-2
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+2
-2
azure_mounter.go
pkg/volume/azure_dd/azure_mounter.go
+2
-2
azure_file.go
pkg/volume/azure_file/azure_file.go
+2
-2
cephfs.go
pkg/volume/cephfs/cephfs.go
+2
-2
attacher.go
pkg/volume/cinder/attacher.go
+3
-3
cinder.go
pkg/volume/cinder/cinder.go
+3
-3
configmap.go
pkg/volume/configmap/configmap.go
+2
-2
empty_dir.go
pkg/volume/empty_dir/empty_dir.go
+2
-2
attacher.go
pkg/volume/fc/attacher.go
+4
-4
fc.go
pkg/volume/fc/fc.go
+2
-2
attacher.go
pkg/volume/flexvolume/attacher.go
+2
-2
detacher-defaults.go
pkg/volume/flexvolume/detacher-defaults.go
+1
-1
detacher.go
pkg/volume/flexvolume/detacher.go
+1
-1
plugin.go
pkg/volume/flexvolume/plugin.go
+3
-3
flocker.go
pkg/volume/flocker/flocker.go
+2
-2
attacher.go
pkg/volume/gce_pd/attacher.go
+3
-3
gce_pd.go
pkg/volume/gce_pd/gce_pd.go
+3
-3
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+2
-2
iscsi.go
pkg/volume/iscsi/iscsi.go
+2
-2
local.go
pkg/volume/local/local.go
+2
-2
nfs.go
pkg/volume/nfs/nfs.go
+2
-2
attacher.go
pkg/volume/photon_pd/attacher.go
+3
-3
photon_pd.go
pkg/volume/photon_pd/photon_pd.go
+3
-3
plugins.go
pkg/volume/plugins.go
+1
-1
portworx.go
pkg/volume/portworx/portworx.go
+3
-3
quobyte.go
pkg/volume/quobyte/quobyte.go
+3
-3
rbd.go
pkg/volume/rbd/rbd.go
+2
-2
sio_plugin.go
pkg/volume/scaleio/sio_plugin.go
+1
-1
secret.go
pkg/volume/secret/secret.go
+2
-2
storageos.go
pkg/volume/storageos/storageos.go
+2
-2
testing.go
pkg/volume/testing/testing.go
+1
-1
attacher.go
pkg/volume/vsphere_volume/attacher.go
+3
-3
vsphere_volume.go
pkg/volume/vsphere_volume/vsphere_volume.go
+3
-3
No files found.
pkg/controller/volume/attachdetach/attach_detach_controller.go
View file @
bc0e170d
...
@@ -539,7 +539,7 @@ func (adc *attachDetachController) GetCloudProvider() cloudprovider.Interface {
...
@@ -539,7 +539,7 @@ func (adc *attachDetachController) GetCloudProvider() cloudprovider.Interface {
return
adc
.
cloud
return
adc
.
cloud
}
}
func
(
adc
*
attachDetachController
)
GetMounter
()
mount
.
Interface
{
func
(
adc
*
attachDetachController
)
GetMounter
(
pluginName
string
)
mount
.
Interface
{
return
nil
return
nil
}
}
...
...
pkg/controller/volume/persistentvolume/volume_host.go
View file @
bc0e170d
...
@@ -61,7 +61,7 @@ func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interfa
...
@@ -61,7 +61,7 @@ func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interfa
return
ctrl
.
cloud
return
ctrl
.
cloud
}
}
func
(
ctrl
*
PersistentVolumeController
)
GetMounter
()
mount
.
Interface
{
func
(
ctrl
*
PersistentVolumeController
)
GetMounter
(
pluginName
string
)
mount
.
Interface
{
return
nil
return
nil
}
}
...
...
pkg/kubelet/volume_host.go
View file @
bc0e170d
...
@@ -117,7 +117,7 @@ func (kvh *kubeletVolumeHost) GetCloudProvider() cloudprovider.Interface {
...
@@ -117,7 +117,7 @@ func (kvh *kubeletVolumeHost) GetCloudProvider() cloudprovider.Interface {
return
kvh
.
kubelet
.
cloud
return
kvh
.
kubelet
.
cloud
}
}
func
(
kvh
*
kubeletVolumeHost
)
GetMounter
()
mount
.
Interface
{
func
(
kvh
*
kubeletVolumeHost
)
GetMounter
(
pluginName
string
)
mount
.
Interface
{
return
kvh
.
kubelet
.
mounter
return
kvh
.
kubelet
.
mounter
}
}
...
...
pkg/volume/aws_ebs/attacher.go
View file @
bc0e170d
...
@@ -54,7 +54,7 @@ func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error)
...
@@ -54,7 +54,7 @@ func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error)
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
...
@@ -199,7 +199,7 @@ func (attacher *awsElasticBlockStoreAttacher) GetDeviceMountPath(
...
@@ -199,7 +199,7 @@ func (attacher *awsElasticBlockStoreAttacher) GetDeviceMountPath(
// FIXME: this method can be further pruned.
// FIXME: this method can be further pruned.
func
(
attacher
*
awsElasticBlockStoreAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
awsElasticBlockStoreAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
awsElasticBlockStorePluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -247,7 +247,7 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
...
@@ -247,7 +247,7 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
}
}
return
&
awsElasticBlockStoreDetacher
{
return
&
awsElasticBlockStoreDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
awsVolumes
:
awsCloud
,
awsVolumes
:
awsCloud
,
},
nil
},
nil
}
}
...
...
pkg/volume/aws_ebs/aws_ebs.go
View file @
bc0e170d
...
@@ -104,7 +104,7 @@ func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []v1.PersistentVolume
...
@@ -104,7 +104,7 @@ func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []v1.PersistentVolume
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
AWSDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
AWSDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
ebsManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
ebsManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -135,12 +135,12 @@ func (plugin *awsElasticBlockStorePlugin) newMounterInternal(spec *volume.Spec,
...
@@ -135,12 +135,12 @@ func (plugin *awsElasticBlockStorePlugin) newMounterInternal(spec *volume.Spec,
},
},
fsType
:
fsType
,
fsType
:
fsType
,
readOnly
:
readOnly
,
readOnly
:
readOnly
,
diskMounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
plugin
.
host
.
GetMounter
(),
Runner
:
exec
.
New
()}},
nil
diskMounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
Runner
:
exec
.
New
()}},
nil
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
AWSDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
AWSDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
ebsManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
ebsManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
@@ -199,7 +199,7 @@ func getVolumeSource(
...
@@ -199,7 +199,7 @@ func getVolumeSource(
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
ConstructVolumeSpec
(
volName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
ConstructVolumeSpec
(
volName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
volumeID
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
volumeID
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/azure_dd/attacher.go
View file @
bc0e170d
...
@@ -211,7 +211,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error
...
@@ -211,7 +211,7 @@ func (a *azureDiskAttacher) GetDeviceMountPath(spec *volume.Spec) (string, error
}
}
func
(
attacher
*
azureDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
azureDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
plugin
.
host
.
GetMounter
()
mounter
:=
attacher
.
plugin
.
host
.
GetMounter
(
azureDataDiskPluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -277,7 +277,7 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro
...
@@ -277,7 +277,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
:=
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
plugin
.
host
.
GetMounter
())
err
:=
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
plugin
.
host
.
GetMounter
(
detacher
.
plugin
.
GetPluginName
()
))
if
err
==
nil
{
if
err
==
nil
{
glog
.
V
(
4
)
.
Infof
(
"azureDisk - Device %s was unmounted"
,
deviceMountPath
)
glog
.
V
(
4
)
.
Infof
(
"azureDisk - Device %s was unmounted"
,
deviceMountPath
)
}
else
{
}
else
{
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
bc0e170d
...
@@ -190,7 +190,7 @@ func (plugin *azureDataDiskPlugin) NewUnmounter(volName string, podUID types.UID
...
@@ -190,7 +190,7 @@ func (plugin *azureDataDiskPlugin) NewUnmounter(volName string, podUID types.UID
}
}
func
(
plugin
*
azureDataDiskPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
azureDataDiskPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
...
@@ -210,6 +210,6 @@ func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath str
...
@@ -210,6 +210,6 @@ func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath str
}
}
func
(
plugin
*
azureDataDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
azureDataDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
m
:=
plugin
.
host
.
GetMounter
()
m
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
m
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
m
,
deviceMountPath
)
}
}
pkg/volume/azure_dd/azure_mounter.go
View file @
bc0e170d
...
@@ -63,7 +63,7 @@ func (m *azureDiskMounter) GetPath() string {
...
@@ -63,7 +63,7 @@ func (m *azureDiskMounter) GetPath() string {
}
}
func
(
m
*
azureDiskMounter
)
SetUpAt
(
dir
string
,
fsGroup
*
int64
)
error
{
func
(
m
*
azureDiskMounter
)
SetUpAt
(
dir
string
,
fsGroup
*
int64
)
error
{
mounter
:=
m
.
plugin
.
host
.
GetMounter
()
mounter
:=
m
.
plugin
.
host
.
GetMounter
(
m
.
plugin
.
GetPluginName
()
)
volumeSource
,
err
:=
getVolumeSource
(
m
.
spec
)
volumeSource
,
err
:=
getVolumeSource
(
m
.
spec
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -154,7 +154,7 @@ func (u *azureDiskUnmounter) TearDownAt(dir string) error {
...
@@ -154,7 +154,7 @@ func (u *azureDiskUnmounter) TearDownAt(dir string) error {
}
}
glog
.
V
(
4
)
.
Infof
(
"azureDisk - TearDownAt: %s"
,
dir
)
glog
.
V
(
4
)
.
Infof
(
"azureDisk - TearDownAt: %s"
,
dir
)
mounter
:=
u
.
plugin
.
host
.
GetMounter
()
mounter
:=
u
.
plugin
.
host
.
GetMounter
(
u
.
plugin
.
GetPluginName
()
)
mountPoint
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
dir
)
mountPoint
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
dir
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"azureDisk - TearDownAt: %s failed to do IsLikelyNotMountPoint %s"
,
dir
,
err
)
return
fmt
.
Errorf
(
"azureDisk - TearDownAt: %s failed to do IsLikelyNotMountPoint %s"
,
dir
,
err
)
...
...
pkg/volume/azure_file/azure_file.go
View file @
bc0e170d
...
@@ -98,7 +98,7 @@ func (plugin *azureFilePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode
...
@@ -98,7 +98,7 @@ func (plugin *azureFilePlugin) GetAccessModes() []v1.PersistentVolumeAccessMode
}
}
func
(
plugin
*
azureFilePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
azureFilePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
,
&
azureSvc
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
,
&
azureSvc
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
azureFilePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
util
azureUtil
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
azureFilePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
util
azureUtil
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -124,7 +124,7 @@ func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod
...
@@ -124,7 +124,7 @@ func (plugin *azureFilePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod
}
}
func
(
plugin
*
azureFilePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
azureFilePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
azureFilePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
azureFilePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/cephfs/cephfs.go
View file @
bc0e170d
...
@@ -110,7 +110,7 @@ func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.
...
@@ -110,7 +110,7 @@ func (plugin *cephfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.
glog
.
V
(
4
)
.
Infof
(
"found ceph secret info: %s"
,
name
)
glog
.
V
(
4
)
.
Infof
(
"found ceph secret info: %s"
,
name
)
}
}
}
}
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
plugin
.
host
.
GetMounter
(),
secret
)
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
secret
)
}
}
func
(
plugin
*
cephfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
mounter
mount
.
Interface
,
secret
string
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
cephfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
mounter
mount
.
Interface
,
secret
string
)
(
volume
.
Mounter
,
error
)
{
...
@@ -153,7 +153,7 @@ func (plugin *cephfsPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
...
@@ -153,7 +153,7 @@ func (plugin *cephfsPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
}
}
func
(
plugin
*
cephfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
cephfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
cephfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
cephfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/cinder/attacher.go
View file @
bc0e170d
...
@@ -66,7 +66,7 @@ func (plugin *cinderPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -66,7 +66,7 @@ func (plugin *cinderPlugin) NewAttacher() (volume.Attacher, error) {
}
}
func
(
plugin
*
cinderPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
cinderPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
...
@@ -262,7 +262,7 @@ func (attacher *cinderDiskAttacher) GetDeviceMountPath(
...
@@ -262,7 +262,7 @@ func (attacher *cinderDiskAttacher) GetDeviceMountPath(
// FIXME: this method can be further pruned.
// FIXME: this method can be further pruned.
func
(
attacher
*
cinderDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
cinderDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
cinderVolumePluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -309,7 +309,7 @@ func (plugin *cinderPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -309,7 +309,7 @@ func (plugin *cinderPlugin) NewDetacher() (volume.Detacher, error) {
return
nil
,
err
return
nil
,
err
}
}
return
&
cinderDiskDetacher
{
return
&
cinderDiskDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
cinderProvider
:
cinder
,
cinderProvider
:
cinder
,
},
nil
},
nil
}
}
...
...
pkg/volume/cinder/cinder.go
View file @
bc0e170d
...
@@ -116,7 +116,7 @@ func (plugin *cinderPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
...
@@ -116,7 +116,7 @@ func (plugin *cinderPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
}
}
func
(
plugin
*
cinderPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
cinderPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
CinderDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
CinderDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
cinderPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
cdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
cinderPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
cdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -143,7 +143,7 @@ func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
...
@@ -143,7 +143,7 @@ func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.U
}
}
func
(
plugin
*
cinderPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
cinderPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
CinderDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
CinderDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
cinderPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
cdManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
cinderPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
cdManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
@@ -216,7 +216,7 @@ func (plugin *cinderPlugin) getCloudProvider() (CinderProvider, error) {
...
@@ -216,7 +216,7 @@ func (plugin *cinderPlugin) getCloudProvider() (CinderProvider, error) {
}
}
func
(
plugin
*
cinderPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
cinderPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/configmap/configmap.go
View file @
bc0e170d
...
@@ -92,7 +92,7 @@ func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts v
...
@@ -92,7 +92,7 @@ func (plugin *configMapPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts v
spec
.
Name
(),
spec
.
Name
(),
pod
.
UID
,
pod
.
UID
,
plugin
,
plugin
,
plugin
.
host
.
GetMounter
(),
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
host
.
GetWriter
(),
plugin
.
host
.
GetWriter
(),
volume
.
MetricsNil
{},
volume
.
MetricsNil
{},
},
},
...
@@ -109,7 +109,7 @@ func (plugin *configMapPlugin) NewUnmounter(volName string, podUID types.UID) (v
...
@@ -109,7 +109,7 @@ func (plugin *configMapPlugin) NewUnmounter(volName string, podUID types.UID) (v
volName
,
volName
,
podUID
,
podUID
,
plugin
,
plugin
,
plugin
.
host
.
GetMounter
(),
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
host
.
GetWriter
(),
plugin
.
host
.
GetWriter
(),
volume
.
MetricsNil
{},
volume
.
MetricsNil
{},
},
},
...
...
pkg/volume/empty_dir/empty_dir.go
View file @
bc0e170d
...
@@ -99,7 +99,7 @@ func (plugin *emptyDirPlugin) SupportsBulkVolumeVerification() bool {
...
@@ -99,7 +99,7 @@ func (plugin *emptyDirPlugin) SupportsBulkVolumeVerification() bool {
}
}
func
(
plugin
*
emptyDirPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
opts
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
emptyDirPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
opts
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(
),
&
realMountDetector
{
plugin
.
host
.
GetMounter
(
)},
opts
)
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()),
&
realMountDetector
{
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)},
opts
)
}
}
func
(
plugin
*
emptyDirPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
,
mountDetector
mountDetector
,
opts
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
emptyDirPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
,
mountDetector
mountDetector
,
opts
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
...
@@ -120,7 +120,7 @@ func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod,
...
@@ -120,7 +120,7 @@ func (plugin *emptyDirPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod,
func
(
plugin
*
emptyDirPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
emptyDirPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
),
&
realMountDetector
{
plugin
.
host
.
GetMounter
(
)})
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()),
&
realMountDetector
{
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)})
}
}
func
(
plugin
*
emptyDirPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
,
mountDetector
mountDetector
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
emptyDirPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
,
mountDetector
mountDetector
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/fc/attacher.go
View file @
bc0e170d
...
@@ -50,7 +50,7 @@ func (plugin *fcPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -50,7 +50,7 @@ func (plugin *fcPlugin) NewAttacher() (volume.Attacher, error) {
}
}
func
(
plugin
*
fcPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
fcPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
...
@@ -88,7 +88,7 @@ func (attacher *fcAttacher) GetDeviceMountPath(
...
@@ -88,7 +88,7 @@ func (attacher *fcAttacher) GetDeviceMountPath(
}
}
func
(
attacher
*
fcAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
fcAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
fcPluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -132,7 +132,7 @@ var _ volume.Detacher = &fcDetacher{}
...
@@ -132,7 +132,7 @@ var _ volume.Detacher = &fcDetacher{}
func
(
plugin
*
fcPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
fcPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
return
&
fcDetacher
{
return
&
fcDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
manager
:
&
FCUtil
{},
manager
:
&
FCUtil
{},
exe
:
exec
.
New
(),
exe
:
exec
.
New
(),
},
nil
},
nil
...
@@ -192,7 +192,7 @@ func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMoun
...
@@ -192,7 +192,7 @@ func volumeSpecToMounter(spec *volume.Spec, host volume.VolumeHost) (*fcDiskMoun
},
},
fsType
:
fc
.
FSType
,
fsType
:
fc
.
FSType
,
readOnly
:
readOnly
,
readOnly
:
readOnly
,
mounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
host
.
GetMounter
(),
Runner
:
exec
.
New
()},
mounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
host
.
GetMounter
(
fcPluginName
),
Runner
:
exec
.
New
()},
},
nil
},
nil
}
}
...
...
pkg/volume/fc/fc.go
View file @
bc0e170d
...
@@ -103,7 +103,7 @@ func (plugin *fcPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
...
@@ -103,7 +103,7 @@ func (plugin *fcPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
func
(
plugin
*
fcPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
fcPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
FCUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
FCUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
fcPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
fcPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -144,7 +144,7 @@ func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
...
@@ -144,7 +144,7 @@ func (plugin *fcPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
func
(
plugin
*
fcPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
fcPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
FCUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
FCUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
fcPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
fcPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/flexvolume/attacher.go
View file @
bc0e170d
...
@@ -69,7 +69,7 @@ func (a *flexVolumeAttacher) GetDeviceMountPath(spec *volume.Spec) (string, erro
...
@@ -69,7 +69,7 @@ func (a *flexVolumeAttacher) GetDeviceMountPath(spec *volume.Spec) (string, erro
// MountDevice is part of the volume.Attacher interface
// MountDevice is part of the volume.Attacher interface
func
(
a
*
flexVolumeAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
a
*
flexVolumeAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
// Mount only once.
// Mount only once.
alreadyMounted
,
err
:=
prepareForMount
(
a
.
plugin
.
host
.
GetMounter
(),
deviceMountPath
)
alreadyMounted
,
err
:=
prepareForMount
(
a
.
plugin
.
host
.
GetMounter
(
a
.
plugin
.
GetPluginName
()
),
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -87,7 +87,7 @@ func (a *flexVolumeAttacher) MountDevice(spec *volume.Spec, devicePath string, d
...
@@ -87,7 +87,7 @@ func (a *flexVolumeAttacher) MountDevice(spec *volume.Spec, devicePath string, d
// Devicepath is empty if the plugin does not support attach calls. Ignore mountDevice calls if the
// Devicepath is empty if the plugin does not support attach calls. Ignore mountDevice calls if the
// plugin does not implement attach interface.
// plugin does not implement attach interface.
if
devicePath
!=
""
{
if
devicePath
!=
""
{
return
(
*
attacherDefaults
)(
a
)
.
MountDevice
(
spec
,
devicePath
,
deviceMountPath
,
a
.
plugin
.
host
.
GetMounter
())
return
(
*
attacherDefaults
)(
a
)
.
MountDevice
(
spec
,
devicePath
,
deviceMountPath
,
a
.
plugin
.
host
.
GetMounter
(
a
.
plugin
.
GetPluginName
()
))
}
else
{
}
else
{
return
nil
return
nil
}
}
...
...
pkg/volume/flexvolume/detacher-defaults.go
View file @
bc0e170d
...
@@ -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
{
glog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default UnmountDevice for device mount path "
,
deviceMountPath
)
glog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default UnmountDevice for device mount path "
,
deviceMountPath
)
return
util
.
UnmountPath
(
deviceMountPath
,
d
.
plugin
.
host
.
GetMounter
())
return
util
.
UnmountPath
(
deviceMountPath
,
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
()
))
}
}
pkg/volume/flexvolume/detacher.go
View file @
bc0e170d
...
@@ -69,7 +69,7 @@ func (d *flexVolumeDetacher) UnmountDevice(deviceMountPath string) error {
...
@@ -69,7 +69,7 @@ func (d *flexVolumeDetacher) UnmountDevice(deviceMountPath string) error {
return
nil
return
nil
}
}
notmnt
,
err
:=
isNotMounted
(
d
.
plugin
.
host
.
GetMounter
(),
deviceMountPath
)
notmnt
,
err
:=
isNotMounted
(
d
.
plugin
.
host
.
GetMounter
(
d
.
plugin
.
GetPluginName
()
),
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/volume/flexvolume/plugin.go
View file @
bc0e170d
...
@@ -158,7 +158,7 @@ func (plugin *flexVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMod
...
@@ -158,7 +158,7 @@ func (plugin *flexVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMod
// NewMounter is part of the volume.VolumePlugin interface.
// NewMounter is part of the volume.VolumePlugin interface.
func
(
plugin
*
flexVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
api
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
flexVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
api
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(),
plugin
.
runner
)
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
runner
)
}
}
// newMounterInternal is the internal mounter routine to build the volume.
// newMounterInternal is the internal mounter routine to build the volume.
...
@@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P
...
@@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P
// NewUnmounter is part of the volume.VolumePlugin interface.
// NewUnmounter is part of the volume.VolumePlugin interface.
func
(
plugin
*
flexVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
flexVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(),
plugin
.
runner
)
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
runner
)
}
}
// newUnmounterInternal is the internal unmounter routine to clean the volume.
// newUnmounterInternal is the internal unmounter routine to clean the volume.
...
@@ -254,7 +254,7 @@ func (plugin *flexVolumePlugin) isUnsupported(command string) bool {
...
@@ -254,7 +254,7 @@ func (plugin *flexVolumePlugin) isUnsupported(command string) bool {
}
}
func
(
plugin
*
flexVolumePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
flexVolumePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
...
...
pkg/volume/flocker/flocker.go
View file @
bc0e170d
...
@@ -138,7 +138,7 @@ func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*v1.FlockerVo
...
@@ -138,7 +138,7 @@ func (p *flockerPlugin) getFlockerVolumeSource(spec *volume.Spec) (*v1.FlockerVo
func
(
plugin
*
flockerPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
flockerPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
FlockerUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
FlockerUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
flockerPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
volumeManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
flockerPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
volumeManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -166,7 +166,7 @@ func (plugin *flockerPlugin) newMounterInternal(spec *volume.Spec, podUID types.
...
@@ -166,7 +166,7 @@ func (plugin *flockerPlugin) newMounterInternal(spec *volume.Spec, podUID types.
func
(
p
*
flockerPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
p
*
flockerPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
p
.
newUnmounterInternal
(
volName
,
podUID
,
&
FlockerUtil
{},
p
.
host
.
GetMounter
())
return
p
.
newUnmounterInternal
(
volName
,
podUID
,
&
FlockerUtil
{},
p
.
host
.
GetMounter
(
p
.
GetPluginName
()
))
}
}
func
(
p
*
flockerPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
volumeManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
p
*
flockerPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
volumeManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/gce_pd/attacher.go
View file @
bc0e170d
...
@@ -56,7 +56,7 @@ func (plugin *gcePersistentDiskPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -56,7 +56,7 @@ func (plugin *gcePersistentDiskPlugin) NewAttacher() (volume.Attacher, error) {
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
...
@@ -185,7 +185,7 @@ func (attacher *gcePersistentDiskAttacher) GetDeviceMountPath(
...
@@ -185,7 +185,7 @@ func (attacher *gcePersistentDiskAttacher) GetDeviceMountPath(
func
(
attacher
*
gcePersistentDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
gcePersistentDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
// Only mount the PD globally once.
// Only mount the PD globally once.
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -272,5 +272,5 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, nodeNa
...
@@ -272,5 +272,5 @@ func (detacher *gcePersistentDiskDetacher) Detach(deviceMountPath string, nodeNa
}
}
func
(
detacher
*
gcePersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
func
(
detacher
*
gcePersistentDiskDetacher
)
UnmountDevice
(
deviceMountPath
string
)
error
{
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
host
.
GetMounter
())
return
volumeutil
.
UnmountPath
(
deviceMountPath
,
detacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
))
}
}
pkg/volume/gce_pd/gce_pd.go
View file @
bc0e170d
...
@@ -100,7 +100,7 @@ func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAcc
...
@@ -100,7 +100,7 @@ func (plugin *gcePersistentDiskPlugin) GetAccessModes() []v1.PersistentVolumeAcc
func
(
plugin
*
gcePersistentDiskPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
GCEDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
GCEDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
getVolumeSource
(
func
getVolumeSource
(
...
@@ -145,7 +145,7 @@ func (plugin *gcePersistentDiskPlugin) newMounterInternal(spec *volume.Spec, pod
...
@@ -145,7 +145,7 @@ func (plugin *gcePersistentDiskPlugin) newMounterInternal(spec *volume.Spec, pod
func
(
plugin
*
gcePersistentDiskPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
GCEDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
GCEDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
@@ -191,7 +191,7 @@ func (plugin *gcePersistentDiskPlugin) newProvisionerInternal(options volume.Vol
...
@@ -191,7 +191,7 @@ func (plugin *gcePersistentDiskPlugin) newProvisionerInternal(options volume.Vol
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
sourceName
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/glusterfs/glusterfs.go
View file @
bc0e170d
...
@@ -152,7 +152,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
...
@@ -152,7 +152,7 @@ func (plugin *glusterfsPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
return
nil
,
err
return
nil
,
err
}
}
glog
.
V
(
1
)
.
Infof
(
"glusterfs: endpoints %v"
,
ep
)
glog
.
V
(
1
)
.
Infof
(
"glusterfs: endpoints %v"
,
ep
)
return
plugin
.
newMounterInternal
(
spec
,
ep
,
pod
,
plugin
.
host
.
GetMounter
(),
exec
.
New
())
return
plugin
.
newMounterInternal
(
spec
,
ep
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
exec
.
New
())
}
}
func
(
plugin
*
glusterfsPlugin
)
getGlusterVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
)
{
func
(
plugin
*
glusterfsPlugin
)
getGlusterVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
GlusterfsVolumeSource
,
bool
)
{
...
@@ -182,7 +182,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp
...
@@ -182,7 +182,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp
}
}
func
(
plugin
*
glusterfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
glusterfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
glusterfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
glusterfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/iscsi/iscsi.go
View file @
bc0e170d
...
@@ -112,7 +112,7 @@ func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.V
...
@@ -112,7 +112,7 @@ func (plugin *iscsiPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.V
}
}
}
}
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
ISCSIUtil
{},
plugin
.
host
.
GetMounter
(),
secret
)
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
ISCSIUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
secret
)
}
}
func
(
plugin
*
iscsiPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
,
secret
map
[
string
]
string
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
,
secret
map
[
string
]
string
)
(
volume
.
Mounter
,
error
)
{
...
@@ -155,7 +155,7 @@ func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UI
...
@@ -155,7 +155,7 @@ func (plugin *iscsiPlugin) newMounterInternal(spec *volume.Spec, podUID types.UI
func
(
plugin
*
iscsiPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
ISCSIUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
ISCSIUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
iscsiPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/local/local.go
View file @
bc0e170d
...
@@ -104,7 +104,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo
...
@@ -104,7 +104,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo
localVolume
:
&
localVolume
{
localVolume
:
&
localVolume
{
podUID
:
pod
.
UID
,
podUID
:
pod
.
UID
,
volName
:
spec
.
Name
(),
volName
:
spec
.
Name
(),
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
:
plugin
,
plugin
:
plugin
,
globalPath
:
volumeSource
.
Path
,
globalPath
:
volumeSource
.
Path
,
MetricsProvider
:
volume
.
NewMetricsStatFS
(
volumeSource
.
Path
),
MetricsProvider
:
volume
.
NewMetricsStatFS
(
volumeSource
.
Path
),
...
@@ -119,7 +119,7 @@ func (plugin *localVolumePlugin) NewUnmounter(volName string, podUID types.UID)
...
@@ -119,7 +119,7 @@ func (plugin *localVolumePlugin) NewUnmounter(volName string, podUID types.UID)
localVolume
:
&
localVolume
{
localVolume
:
&
localVolume
{
podUID
:
podUID
,
podUID
:
podUID
,
volName
:
volName
,
volName
:
volName
,
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
:
plugin
,
plugin
:
plugin
,
},
},
},
nil
},
nil
...
...
pkg/volume/nfs/nfs.go
View file @
bc0e170d
...
@@ -105,7 +105,7 @@ func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
...
@@ -105,7 +105,7 @@ func (plugin *nfsPlugin) GetAccessModes() []v1.PersistentVolumeAccessMode {
}
}
func
(
plugin
*
nfsPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
nfsPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
nfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
nfsPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -129,7 +129,7 @@ func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, moun
...
@@ -129,7 +129,7 @@ func (plugin *nfsPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod, moun
}
}
func
(
plugin
*
nfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
nfsPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
nfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
nfsPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/photon_pd/attacher.go
View file @
bc0e170d
...
@@ -180,13 +180,13 @@ func (attacher *photonPersistentDiskAttacher) GetDeviceMountPath(spec *volume.Sp
...
@@ -180,13 +180,13 @@ func (attacher *photonPersistentDiskAttacher) GetDeviceMountPath(spec *volume.Sp
// GetMountDeviceRefs finds all other references to the device referenced
// GetMountDeviceRefs finds all other references to the device referenced
// by deviceMountPath; returns a list of paths.
// by deviceMountPath; returns a list of paths.
func
(
plugin
*
photonPersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
// MountDevice mounts device to global mount point.
// MountDevice mounts device to global mount point.
func
(
attacher
*
photonPersistentDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
photonPersistentDiskAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
photonPersistentDiskPluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -236,7 +236,7 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error)
...
@@ -236,7 +236,7 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error)
}
}
return
&
photonPersistentDiskDetacher
{
return
&
photonPersistentDiskDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
photonDisks
:
photonCloud
,
photonDisks
:
photonCloud
,
},
nil
},
nil
}
}
...
...
pkg/volume/photon_pd/photon_pd.go
View file @
bc0e170d
...
@@ -89,11 +89,11 @@ func (plugin *photonPersistentDiskPlugin) SupportsBulkVolumeVerification() bool
...
@@ -89,11 +89,11 @@ func (plugin *photonPersistentDiskPlugin) SupportsBulkVolumeVerification() bool
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
PhotonDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
PhotonDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
PhotonDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
PhotonDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
pdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -131,7 +131,7 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p
...
@@ -131,7 +131,7 @@ func (plugin *photonPersistentDiskPlugin) newUnmounterInternal(volName string, p
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
ConstructVolumeSpec
(
volumeSpecName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
ConstructVolumeSpec
(
volumeSpecName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pdID
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
pdID
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/volume/plugins.go
View file @
bc0e170d
...
@@ -224,7 +224,7 @@ type VolumeHost interface {
...
@@ -224,7 +224,7 @@ type VolumeHost interface {
GetCloudProvider
()
cloudprovider
.
Interface
GetCloudProvider
()
cloudprovider
.
Interface
// Get mounter interface.
// Get mounter interface.
GetMounter
()
mount
.
Interface
GetMounter
(
pluginName
string
)
mount
.
Interface
// Get writer interface for writing data to disk.
// Get writer interface for writing data to disk.
GetWriter
()
io
.
Writer
GetWriter
()
io
.
Writer
...
...
pkg/volume/portworx/portworx.go
View file @
bc0e170d
...
@@ -91,7 +91,7 @@ func (plugin *portworxVolumePlugin) GetAccessModes() []v1.PersistentVolumeAccess
...
@@ -91,7 +91,7 @@ func (plugin *portworxVolumePlugin) GetAccessModes() []v1.PersistentVolumeAccess
}
}
func
(
plugin
*
portworxVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
portworxVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
plugin
.
util
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
plugin
.
util
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
portworxVolumePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
portworxManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
portworxVolumePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
portworxManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -115,11 +115,11 @@ func (plugin *portworxVolumePlugin) newMounterInternal(spec *volume.Spec, podUID
...
@@ -115,11 +115,11 @@ func (plugin *portworxVolumePlugin) newMounterInternal(spec *volume.Spec, podUID
},
},
fsType
:
fsType
,
fsType
:
fsType
,
readOnly
:
readOnly
,
readOnly
:
readOnly
,
diskMounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
plugin
.
host
.
GetMounter
(),
Runner
:
exec
.
New
()}},
nil
diskMounter
:
&
mount
.
SafeFormatAndMount
{
Interface
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
Runner
:
exec
.
New
()}},
nil
}
}
func
(
plugin
*
portworxVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
portworxVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
util
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
util
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
portworxVolumePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
portworxManager
,
func
(
plugin
*
portworxVolumePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
portworxManager
,
...
...
pkg/volume/quobyte/quobyte.go
View file @
bc0e170d
...
@@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool {
...
@@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool {
}
}
// If Quobyte is already mounted we don't need to check if the binary is installed
// If Quobyte is already mounted we don't need to check if the binary is installed
if
mounter
,
err
:=
plugin
.
newMounterInternal
(
spec
,
nil
,
plugin
.
host
.
GetMounter
());
err
==
nil
{
if
mounter
,
err
:=
plugin
.
newMounterInternal
(
spec
,
nil
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
));
err
==
nil
{
qm
,
_
:=
mounter
.
(
*
quobyteMounter
)
qm
,
_
:=
mounter
.
(
*
quobyteMounter
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
strings
.
EscapeQualifiedNameForDisk
(
quobytePluginName
))
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
strings
.
EscapeQualifiedNameForDisk
(
quobytePluginName
))
if
mounted
,
err
:=
qm
.
pluginDirIsMounted
(
pluginDir
);
mounted
&&
err
==
nil
{
if
mounted
,
err
:=
qm
.
pluginDirIsMounted
(
pluginDir
);
mounted
&&
err
==
nil
{
...
@@ -155,7 +155,7 @@ func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) (
...
@@ -155,7 +155,7 @@ func (plugin *quobytePlugin) ConstructVolumeSpec(volumeName, mountPath string) (
}
}
func
(
plugin
*
quobytePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
quobytePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
quobytePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
quobytePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -181,7 +181,7 @@ func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod,
...
@@ -181,7 +181,7 @@ func (plugin *quobytePlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod,
}
}
func
(
plugin
*
quobytePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
quobytePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
quobytePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
quobytePlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/rbd/rbd.go
View file @
bc0e170d
...
@@ -131,7 +131,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.Vol
...
@@ -131,7 +131,7 @@ func (plugin *rbdPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volume.Vol
}
}
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
RBDUtil
{},
plugin
.
host
.
GetMounter
(),
secret
)
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
RBDUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
secret
)
}
}
func
(
plugin
*
rbdPlugin
)
getRBDVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
RBDVolumeSource
,
bool
)
{
func
(
plugin
*
rbdPlugin
)
getRBDVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
RBDVolumeSource
,
bool
)
{
...
@@ -173,7 +173,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
...
@@ -173,7 +173,7 @@ func (plugin *rbdPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID,
func
(
plugin
*
rbdPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
rbdPlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
// Inject real implementations here, test through the internal function.
// Inject real implementations here, test through the internal function.
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
RBDUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
RBDUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
rbdPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
rbdPlugin
)
newUnmounterInternal
(
volName
string
,
podUID
types
.
UID
,
manager
diskManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/scaleio/sio_plugin.go
View file @
bc0e170d
...
@@ -53,7 +53,7 @@ var _ volume.VolumePlugin = &sioPlugin{}
...
@@ -53,7 +53,7 @@ var _ volume.VolumePlugin = &sioPlugin{}
func
(
p
*
sioPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
func
(
p
*
sioPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
p
.
host
=
host
p
.
host
=
host
p
.
mounter
=
host
.
GetMounter
()
p
.
mounter
=
host
.
GetMounter
(
p
.
GetPluginName
()
)
p
.
volumeMtx
=
keymutex
.
NewKeyMutex
()
p
.
volumeMtx
=
keymutex
.
NewKeyMutex
()
return
nil
return
nil
}
}
...
...
pkg/volume/secret/secret.go
View file @
bc0e170d
...
@@ -99,7 +99,7 @@ func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volu
...
@@ -99,7 +99,7 @@ func (plugin *secretPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, opts volu
spec
.
Name
(),
spec
.
Name
(),
pod
.
UID
,
pod
.
UID
,
plugin
,
plugin
,
plugin
.
host
.
GetMounter
(),
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
host
.
GetWriter
(),
plugin
.
host
.
GetWriter
(),
volume
.
NewCachedMetrics
(
volume
.
NewMetricsDu
(
getPath
(
pod
.
UID
,
spec
.
Name
(),
plugin
.
host
))),
volume
.
NewCachedMetrics
(
volume
.
NewMetricsDu
(
getPath
(
pod
.
UID
,
spec
.
Name
(),
plugin
.
host
))),
},
},
...
@@ -116,7 +116,7 @@ func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volu
...
@@ -116,7 +116,7 @@ func (plugin *secretPlugin) NewUnmounter(volName string, podUID types.UID) (volu
volName
,
volName
,
podUID
,
podUID
,
plugin
,
plugin
,
plugin
.
host
.
GetMounter
(),
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
plugin
.
host
.
GetWriter
(),
plugin
.
host
.
GetWriter
(),
volume
.
NewCachedMetrics
(
volume
.
NewMetricsDu
(
getPath
(
podUID
,
volName
,
plugin
.
host
))),
volume
.
NewCachedMetrics
(
volume
.
NewMetricsDu
(
getPath
(
podUID
,
volName
,
plugin
.
host
))),
},
},
...
...
pkg/volume/storageos/storageos.go
View file @
bc0e170d
...
@@ -111,7 +111,7 @@ func (plugin *storageosPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
...
@@ -111,7 +111,7 @@ func (plugin *storageosPlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ volu
return
nil
,
err
return
nil
,
err
}
}
return
plugin
.
newMounterInternal
(
spec
,
pod
,
apiCfg
,
&
storageosUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
,
apiCfg
,
&
storageosUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
storageosPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
apiCfg
*
storageosAPIConfig
,
manager
storageosManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
storageosPlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
apiCfg
*
storageosAPIConfig
,
manager
storageosManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -142,7 +142,7 @@ func (plugin *storageosPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod
...
@@ -142,7 +142,7 @@ func (plugin *storageosPlugin) newMounterInternal(spec *volume.Spec, pod *v1.Pod
}
}
func
(
plugin
*
storageosPlugin
)
NewUnmounter
(
pvName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
storageosPlugin
)
NewUnmounter
(
pvName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
pvName
,
podUID
,
&
storageosUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
pvName
,
podUID
,
&
storageosUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
storageosPlugin
)
newUnmounterInternal
(
pvName
string
,
podUID
types
.
UID
,
manager
storageosManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
storageosPlugin
)
newUnmounterInternal
(
pvName
string
,
podUID
types
.
UID
,
manager
storageosManager
,
mounter
mount
.
Interface
)
(
volume
.
Unmounter
,
error
)
{
...
...
pkg/volume/testing/testing.go
View file @
bc0e170d
...
@@ -90,7 +90,7 @@ func (f *fakeVolumeHost) GetCloudProvider() cloudprovider.Interface {
...
@@ -90,7 +90,7 @@ func (f *fakeVolumeHost) GetCloudProvider() cloudprovider.Interface {
return
f
.
cloud
return
f
.
cloud
}
}
func
(
f
*
fakeVolumeHost
)
GetMounter
()
mount
.
Interface
{
func
(
f
*
fakeVolumeHost
)
GetMounter
(
pluginName
string
)
mount
.
Interface
{
return
f
.
mounter
return
f
.
mounter
}
}
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
bc0e170d
...
@@ -167,13 +167,13 @@ func (attacher *vsphereVMDKAttacher) GetDeviceMountPath(spec *volume.Spec) (stri
...
@@ -167,13 +167,13 @@ func (attacher *vsphereVMDKAttacher) GetDeviceMountPath(spec *volume.Spec) (stri
// GetMountDeviceRefs finds all other references to the device referenced
// GetMountDeviceRefs finds all other references to the device referenced
// by deviceMountPath; returns a list of paths.
// by deviceMountPath; returns a list of paths.
func
(
plugin
*
vsphereVolumePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
return
mount
.
GetMountRefs
(
mounter
,
deviceMountPath
)
}
}
// MountDevice mounts device to global mount point.
// MountDevice mounts device to global mount point.
func
(
attacher
*
vsphereVMDKAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
func
(
attacher
*
vsphereVMDKAttacher
)
MountDevice
(
spec
*
volume
.
Spec
,
devicePath
string
,
deviceMountPath
string
)
error
{
mounter
:=
attacher
.
host
.
GetMounter
()
mounter
:=
attacher
.
host
.
GetMounter
(
vsphereVolumePluginName
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
notMnt
,
err
:=
mounter
.
IsLikelyNotMountPoint
(
deviceMountPath
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
...
@@ -221,7 +221,7 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -221,7 +221,7 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) {
}
}
return
&
vsphereVMDKDetacher
{
return
&
vsphereVMDKDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
),
vsphereVolumes
:
vsphereCloud
,
vsphereVolumes
:
vsphereCloud
,
},
nil
},
nil
}
}
...
...
pkg/volume/vsphere_volume/vsphere_volume.go
View file @
bc0e170d
...
@@ -90,11 +90,11 @@ func (plugin *vsphereVolumePlugin) SupportsBulkVolumeVerification() bool {
...
@@ -90,11 +90,11 @@ func (plugin *vsphereVolumePlugin) SupportsBulkVolumeVerification() bool {
}
}
func
(
plugin
*
vsphereVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
NewMounter
(
spec
*
volume
.
Spec
,
pod
*
v1
.
Pod
,
_
volume
.
VolumeOptions
)
(
volume
.
Mounter
,
error
)
{
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
VsphereDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newMounterInternal
(
spec
,
pod
.
UID
,
&
VsphereDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
vsphereVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
NewUnmounter
(
volName
string
,
podUID
types
.
UID
)
(
volume
.
Unmounter
,
error
)
{
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
VsphereDiskUtil
{},
plugin
.
host
.
GetMounter
())
return
plugin
.
newUnmounterInternal
(
volName
,
podUID
,
&
VsphereDiskUtil
{},
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
))
}
}
func
(
plugin
*
vsphereVolumePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
vdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
newMounterInternal
(
spec
*
volume
.
Spec
,
podUID
types
.
UID
,
manager
vdManager
,
mounter
mount
.
Interface
)
(
volume
.
Mounter
,
error
)
{
...
@@ -131,7 +131,7 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t
...
@@ -131,7 +131,7 @@ func (plugin *vsphereVolumePlugin) newUnmounterInternal(volName string, podUID t
}
}
func
(
plugin
*
vsphereVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
()
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
plugin
.
GetPluginName
())
volumePath
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
volumePath
,
err
:=
mounter
.
GetDeviceNameFromMount
(
mountPath
,
pluginDir
)
if
err
!=
nil
{
if
err
!=
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