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
fa9b36de
Unverified
Commit
fa9b36de
authored
Apr 08, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76151 from vladimirvivien/plugin-CanAttach-return-error
Ability for volume AttachablePlugin.CanAttach() to return both bool and error
parents
65dc445a
cfafde98
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
131 additions
and
43 deletions
+131
-43
testvolumespec.go
pkg/controller/volume/attachdetach/testing/testvolumespec.go
+2
-2
attacher.go
pkg/volume/awsebs/attacher.go
+2
-2
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+2
-2
attacher.go
pkg/volume/cinder/attacher.go
+2
-2
csi_attacher_test.go
pkg/volume/csi/csi_attacher_test.go
+8
-2
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+7
-11
csi_plugin_test.go
pkg/volume/csi/csi_plugin_test.go
+86
-2
attacher.go
pkg/volume/fc/attacher.go
+2
-2
plugin.go
pkg/volume/flexvolume/plugin.go
+2
-2
attacher.go
pkg/volume/gcepd/attacher.go
+2
-2
attacher.go
pkg/volume/iscsi/attacher.go
+2
-2
attacher.go
pkg/volume/photon_pd/attacher.go
+2
-2
plugins.go
pkg/volume/plugins.go
+4
-2
attacher.go
pkg/volume/rbd/attacher.go
+2
-2
testing.go
pkg/volume/testing/testing.go
+4
-4
attacher.go
pkg/volume/vsphere_volume/attacher.go
+2
-2
No files found.
pkg/controller/volume/attachdetach/testing/testvolumespec.go
View file @
fa9b36de
...
@@ -308,8 +308,8 @@ func (plugin *TestPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -308,8 +308,8 @@ func (plugin *TestPlugin) NewDetacher() (volume.Detacher, error) {
return
&
detacher
,
nil
return
&
detacher
,
nil
}
}
func
(
plugin
*
TestPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
TestPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
TestPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
TestPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/awsebs/attacher.go
View file @
fa9b36de
...
@@ -277,8 +277,8 @@ func (detacher *awsElasticBlockStoreDetacher) UnmountDevice(deviceMountPath stri
...
@@ -277,8 +277,8 @@ func (detacher *awsElasticBlockStoreDetacher) UnmountDevice(deviceMountPath stri
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
fa9b36de
...
@@ -238,8 +238,8 @@ func (plugin *azureDataDiskPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -238,8 +238,8 @@ func (plugin *azureDataDiskPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
azureDataDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
azureDataDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
azureDataDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
azureDataDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/cinder/attacher.go
View file @
fa9b36de
...
@@ -406,8 +406,8 @@ func (detacher *cinderDiskDetacher) UnmountDevice(deviceMountPath string) error
...
@@ -406,8 +406,8 @@ func (detacher *cinderDiskDetacher) UnmountDevice(deviceMountPath string) error
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
(
plugin
*
cinderPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
cinderPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
cinderPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
cinderPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/csi/csi_attacher_test.go
View file @
fa9b36de
...
@@ -348,7 +348,10 @@ func TestAttacherWithCSIDriver(t *testing.T) {
...
@@ -348,7 +348,10 @@ func TestAttacherWithCSIDriver(t *testing.T) {
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-pv"
,
10
,
test
.
driver
,
"test-vol"
),
false
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-pv"
,
10
,
test
.
driver
,
"test-vol"
),
false
)
pluginCanAttach
:=
plug
.
CanAttach
(
spec
)
pluginCanAttach
,
err
:=
plug
.
CanAttach
(
spec
)
if
err
!=
nil
{
t
.
Fatalf
(
"attacher.CanAttach failed: %s"
,
err
)
}
if
pluginCanAttach
!=
test
.
expectVolumeAttachment
{
if
pluginCanAttach
!=
test
.
expectVolumeAttachment
{
t
.
Errorf
(
"attacher.CanAttach does not match expected attachment status %t"
,
test
.
expectVolumeAttachment
)
t
.
Errorf
(
"attacher.CanAttach does not match expected attachment status %t"
,
test
.
expectVolumeAttachment
)
}
}
...
@@ -429,7 +432,10 @@ func TestAttacherWaitForVolumeAttachmentWithCSIDriver(t *testing.T) {
...
@@ -429,7 +432,10 @@ func TestAttacherWaitForVolumeAttachmentWithCSIDriver(t *testing.T) {
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-pv"
,
10
,
test
.
driver
,
"test-vol"
),
false
)
spec
:=
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-pv"
,
10
,
test
.
driver
,
"test-vol"
),
false
)
pluginCanAttach
:=
plug
.
CanAttach
(
spec
)
pluginCanAttach
,
err
:=
plug
.
CanAttach
(
spec
)
if
err
!=
nil
{
t
.
Fatalf
(
"plugin.CanAttach test failed: %s"
,
err
)
}
if
!
pluginCanAttach
{
if
!
pluginCanAttach
{
t
.
Log
(
"plugin is not attachable"
)
t
.
Log
(
"plugin is not attachable"
)
return
return
...
...
pkg/volume/csi/csi_plugin.go
View file @
fa9b36de
...
@@ -581,34 +581,30 @@ func (p *csiPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -581,34 +581,30 @@ func (p *csiPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
// TODO change CanAttach to return error to propagate ability
func
(
p
*
csiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
// to support Attachment or an error - see https://github.com/kubernetes/kubernetes/issues/74810
func
(
p
*
csiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
driverMode
,
err
:=
p
.
getDriverMode
(
spec
)
driverMode
,
err
:=
p
.
getDriverMode
(
spec
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
return
false
,
err
}
}
if
driverMode
==
ephemeralDriverMode
{
if
driverMode
==
ephemeralDriverMode
{
klog
.
V
(
4
)
.
Info
(
log
(
"driver ephemeral mode detected for spec %v"
,
spec
.
Name
))
klog
.
V
(
5
)
.
Info
(
log
(
"plugin.CanAttach = false, ephemeral mode detected for spec %v"
,
spec
.
Name
()
))
return
false
return
false
,
nil
}
}
pvSrc
,
err
:=
getCSISourceFromSpec
(
spec
)
pvSrc
,
err
:=
getCSISourceFromSpec
(
spec
)
if
err
!=
nil
{
if
err
!=
nil
{
klog
.
Error
(
log
(
"plugin.CanAttach failed to get info from spec: %s"
,
err
))
return
false
,
err
return
false
}
}
driverName
:=
pvSrc
.
Driver
driverName
:=
pvSrc
.
Driver
skipAttach
,
err
:=
p
.
skipAttach
(
driverName
)
skipAttach
,
err
:=
p
.
skipAttach
(
driverName
)
if
err
!=
nil
{
if
err
!=
nil
{
klog
.
Error
(
log
(
"plugin.CanAttach error when calling plugin.skipAttach for driver %s: %s"
,
driverName
,
err
))
return
false
,
err
return
false
}
}
return
!
skipAttach
return
!
skipAttach
,
nil
}
}
// TODO (#75352) add proper logic to determine device moutability by inspecting the spec.
// TODO (#75352) add proper logic to determine device moutability by inspecting the spec.
...
...
pkg/volume/csi/csi_plugin_test.go
View file @
fa9b36de
...
@@ -880,6 +880,7 @@ func TestPluginCanAttach(t *testing.T) {
...
@@ -880,6 +880,7 @@ func TestPluginCanAttach(t *testing.T) {
driverName
string
driverName
string
spec
*
volume
.
Spec
spec
*
volume
.
Spec
canAttach
bool
canAttach
bool
shouldFail
bool
}{
}{
{
{
name
:
"non-attachable inline"
,
name
:
"non-attachable inline"
,
...
@@ -893,6 +894,19 @@ func TestPluginCanAttach(t *testing.T) {
...
@@ -893,6 +894,19 @@ func TestPluginCanAttach(t *testing.T) {
spec
:
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-vol"
,
20
,
"attachable-pv"
,
testVol
),
true
),
spec
:
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-vol"
,
20
,
"attachable-pv"
,
testVol
),
true
),
canAttach
:
true
,
canAttach
:
true
,
},
},
{
name
:
"incomplete spec"
,
driverName
:
"attachable-pv"
,
spec
:
&
volume
.
Spec
{
ReadOnly
:
true
},
canAttach
:
false
,
shouldFail
:
true
,
},
{
name
:
"nil spec"
,
driverName
:
"attachable-pv"
,
canAttach
:
false
,
shouldFail
:
true
,
},
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
...
@@ -902,10 +916,80 @@ func TestPluginCanAttach(t *testing.T) {
...
@@ -902,10 +916,80 @@ func TestPluginCanAttach(t *testing.T) {
plug
,
tmpDir
:=
newTestPlugin
(
t
,
fakeCSIClient
)
plug
,
tmpDir
:=
newTestPlugin
(
t
,
fakeCSIClient
)
defer
os
.
RemoveAll
(
tmpDir
)
defer
os
.
RemoveAll
(
tmpDir
)
pluginCanAttach
:=
plug
.
CanAttach
(
test
.
spec
)
pluginCanAttach
,
err
:=
plug
.
CanAttach
(
test
.
spec
)
if
err
!=
nil
&&
!
test
.
shouldFail
{
t
.
Fatalf
(
"unexected plugin.CanAttach error: %s"
,
err
)
}
if
pluginCanAttach
!=
test
.
canAttach
{
if
pluginCanAttach
!=
test
.
canAttach
{
t
.
Fatalf
(
"expecting plugin.CanAttach %t got %t"
,
test
.
canAttach
,
pluginCanAttach
)
t
.
Fatalf
(
"expecting plugin.CanAttach %t got %t"
,
test
.
canAttach
,
pluginCanAttach
)
return
}
})
}
}
func
TestPluginFindAttachablePlugin
(
t
*
testing
.
T
)
{
defer
utilfeaturetesting
.
SetFeatureGateDuringTest
(
t
,
utilfeature
.
DefaultFeatureGate
,
features
.
CSIInlineVolume
,
true
)()
tests
:=
[]
struct
{
name
string
driverName
string
spec
*
volume
.
Spec
canAttach
bool
shouldFail
bool
}{
{
name
:
"non-attachable inline"
,
driverName
:
"attachable-inline"
,
spec
:
volume
.
NewSpecFromVolume
(
makeTestVol
(
"test-vol"
,
"attachable-inline"
)),
canAttach
:
false
,
},
{
name
:
"attachable PV"
,
driverName
:
"attachable-pv"
,
spec
:
volume
.
NewSpecFromPersistentVolume
(
makeTestPV
(
"test-vol"
,
20
,
"attachable-pv"
,
testVol
),
true
),
canAttach
:
true
,
},
{
name
:
"incomplete spec"
,
driverName
:
"attachable-pv"
,
spec
:
&
volume
.
Spec
{
ReadOnly
:
true
},
canAttach
:
false
,
shouldFail
:
true
,
},
{
name
:
"nil spec"
,
driverName
:
"attachable-pv"
,
canAttach
:
false
,
shouldFail
:
true
,
},
}
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
tmpDir
,
err
:=
utiltesting
.
MkTmpdir
(
"csi-test"
)
if
err
!=
nil
{
t
.
Fatalf
(
"can't create temp dir: %v"
,
err
)
}
defer
os
.
RemoveAll
(
tmpDir
)
client
:=
fakeclient
.
NewSimpleClientset
(
getCSIDriver
(
test
.
driverName
,
nil
,
&
test
.
canAttach
))
factory
:=
informers
.
NewSharedInformerFactory
(
client
,
csiResyncPeriod
)
host
:=
volumetest
.
NewFakeVolumeHostWithCSINodeName
(
tmpDir
,
client
,
nil
,
"fakeNode"
,
factory
.
Storage
()
.
V1beta1
()
.
CSIDrivers
()
.
Lister
(),
)
plugMgr
:=
&
volume
.
VolumePluginMgr
{}
plugMgr
.
InitPlugins
(
ProbeVolumePlugins
(),
nil
/* prober */
,
host
)
plugin
,
err
:=
plugMgr
.
FindAttachablePluginBySpec
(
test
.
spec
)
if
err
!=
nil
&&
!
test
.
shouldFail
{
t
.
Fatalf
(
"unexected error calling pluginMgr.FindAttachablePluginBySpec: %s"
,
err
)
}
if
(
plugin
!=
nil
)
!=
test
.
canAttach
{
t
.
Fatal
(
"expecting attachable plugin, but got nil"
)
}
}
})
})
}
}
...
...
pkg/volume/fc/attacher.go
View file @
fa9b36de
...
@@ -175,8 +175,8 @@ func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error {
...
@@ -175,8 +175,8 @@ func (detacher *fcDetacher) UnmountDevice(deviceMountPath string) error {
return
nil
return
nil
}
}
func
(
plugin
*
fcPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
fcPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
fcPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
fcPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/flexvolume/plugin.go
View file @
fa9b36de
...
@@ -256,8 +256,8 @@ func (plugin *flexVolumeAttachablePlugin) NewDeviceUnmounter() (volume.DeviceUnm
...
@@ -256,8 +256,8 @@ func (plugin *flexVolumeAttachablePlugin) NewDeviceUnmounter() (volume.DeviceUnm
return
plugin
.
NewDetacher
()
return
plugin
.
NewDetacher
()
}
}
func
(
plugin
*
flexVolumeAttachablePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
flexVolumeAttachablePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
flexVolumeAttachablePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
flexVolumeAttachablePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/gcepd/attacher.go
View file @
fa9b36de
...
@@ -350,8 +350,8 @@ func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string)
...
@@ -350,8 +350,8 @@ func (detacher *gcePersistentDiskDetacher) UnmountDevice(deviceMountPath string)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
),
false
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
host
.
GetMounter
(
gcePersistentDiskPluginName
),
false
)
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
gcePersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/iscsi/attacher.go
View file @
fa9b36de
...
@@ -176,8 +176,8 @@ func (detacher *iscsiDetacher) UnmountDevice(deviceMountPath string) error {
...
@@ -176,8 +176,8 @@ func (detacher *iscsiDetacher) UnmountDevice(deviceMountPath string) error {
return
nil
return
nil
}
}
func
(
plugin
*
iscsiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
iscsiPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
iscsiPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/photon_pd/attacher.go
View file @
fa9b36de
...
@@ -308,8 +308,8 @@ func (detacher *photonPersistentDiskDetacher) UnmountDevice(deviceMountPath stri
...
@@ -308,8 +308,8 @@ func (detacher *photonPersistentDiskDetacher) UnmountDevice(deviceMountPath stri
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
photonPersistentDiskPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/plugins.go
View file @
fa9b36de
...
@@ -235,7 +235,7 @@ type AttachableVolumePlugin interface {
...
@@ -235,7 +235,7 @@ type AttachableVolumePlugin interface {
NewAttacher
()
(
Attacher
,
error
)
NewAttacher
()
(
Attacher
,
error
)
NewDetacher
()
(
Detacher
,
error
)
NewDetacher
()
(
Detacher
,
error
)
// CanAttach tests if provided volume spec is attachable
// CanAttach tests if provided volume spec is attachable
CanAttach
(
spec
*
Spec
)
bool
CanAttach
(
spec
*
Spec
)
(
bool
,
error
)
}
}
// DeviceMountableVolumePlugin is an extended interface of VolumePlugin and is used
// DeviceMountableVolumePlugin is an extended interface of VolumePlugin and is used
...
@@ -891,7 +891,9 @@ func (pm *VolumePluginMgr) FindAttachablePluginBySpec(spec *Spec) (AttachableVol
...
@@ -891,7 +891,9 @@ func (pm *VolumePluginMgr) FindAttachablePluginBySpec(spec *Spec) (AttachableVol
return
nil
,
err
return
nil
,
err
}
}
if
attachableVolumePlugin
,
ok
:=
volumePlugin
.
(
AttachableVolumePlugin
);
ok
{
if
attachableVolumePlugin
,
ok
:=
volumePlugin
.
(
AttachableVolumePlugin
);
ok
{
if
attachableVolumePlugin
.
CanAttach
(
spec
)
{
if
canAttach
,
err
:=
attachableVolumePlugin
.
CanAttach
(
spec
);
err
!=
nil
{
return
nil
,
err
}
else
if
canAttach
{
return
attachableVolumePlugin
,
nil
return
attachableVolumePlugin
,
nil
}
}
}
}
...
...
pkg/volume/rbd/attacher.go
View file @
fa9b36de
...
@@ -71,8 +71,8 @@ func (plugin *rbdPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, e
...
@@ -71,8 +71,8 @@ func (plugin *rbdPlugin) GetDeviceMountRefs(deviceMountPath string) ([]string, e
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
}
}
func
(
plugin
*
rbdPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
rbdPlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
rbdPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
rbdPlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
pkg/volume/testing/testing.go
View file @
fa9b36de
...
@@ -492,8 +492,8 @@ func (plugin *FakeVolumePlugin) GetNewDetacherCallCount() int {
...
@@ -492,8 +492,8 @@ func (plugin *FakeVolumePlugin) GetNewDetacherCallCount() int {
return
plugin
.
NewDetacherCallCount
return
plugin
.
NewDetacherCallCount
}
}
func
(
plugin
*
FakeVolumePlugin
)
CanAttach
(
spec
*
Spec
)
bool
{
func
(
plugin
*
FakeVolumePlugin
)
CanAttach
(
spec
*
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
FakeVolumePlugin
)
CanDeviceMount
(
spec
*
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
FakeVolumePlugin
)
CanDeviceMount
(
spec
*
Spec
)
(
bool
,
error
)
{
...
@@ -654,8 +654,8 @@ func (f *FakeAttachableVolumePlugin) NewDetacher() (Detacher, error) {
...
@@ -654,8 +654,8 @@ func (f *FakeAttachableVolumePlugin) NewDetacher() (Detacher, error) {
return
f
.
Plugin
.
NewDetacher
()
return
f
.
Plugin
.
NewDetacher
()
}
}
func
(
f
*
FakeAttachableVolumePlugin
)
CanAttach
(
spec
*
Spec
)
bool
{
func
(
f
*
FakeAttachableVolumePlugin
)
CanAttach
(
spec
*
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
var
_
VolumePlugin
=
&
FakeAttachableVolumePlugin
{}
var
_
VolumePlugin
=
&
FakeAttachableVolumePlugin
{}
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
fa9b36de
...
@@ -295,8 +295,8 @@ func (detacher *vsphereVMDKDetacher) UnmountDevice(deviceMountPath string) error
...
@@ -295,8 +295,8 @@ func (detacher *vsphereVMDKDetacher) UnmountDevice(deviceMountPath string) error
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
return
mount
.
CleanupMountPoint
(
deviceMountPath
,
detacher
.
mounter
,
false
)
}
}
func
(
plugin
*
vsphereVolumePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
bool
{
func
(
plugin
*
vsphereVolumePlugin
)
CanAttach
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
return
true
return
true
,
nil
}
}
func
(
plugin
*
vsphereVolumePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
CanDeviceMount
(
spec
*
volume
.
Spec
)
(
bool
,
error
)
{
...
...
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