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
81e360d2
Commit
81e360d2
authored
Aug 01, 2018
by
NickrenREN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update volume plugins accordingly
parent
c7e44668
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
172 additions
and
0 deletions
+172
-0
testvolumespec.go
pkg/controller/volume/attachdetach/testing/testvolumespec.go
+8
-0
attacher.go
pkg/volume/aws_ebs/attacher.go
+14
-0
attacher.go
pkg/volume/azure_dd/attacher.go
+3
-0
azure_dd.go
pkg/volume/azure_dd/azure_dd.go
+9
-0
attacher.go
pkg/volume/cinder/attacher.go
+14
-0
csi_attacher.go
pkg/volume/csi/csi_attacher.go
+4
-0
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+10
-0
attacher.go
pkg/volume/fc/attacher.go
+14
-0
attacher.go
pkg/volume/flexvolume/attacher.go
+2
-0
detacher.go
pkg/volume/flexvolume/detacher.go
+2
-0
plugin.go
pkg/volume/flexvolume/plugin.go
+10
-0
attacher.go
pkg/volume/gce_pd/attacher.go
+14
-0
attacher.go
pkg/volume/iscsi/attacher.go
+14
-0
attacher.go
pkg/volume/photon_pd/attacher.go
+15
-0
attacher.go
pkg/volume/rbd/attacher.go
+14
-0
rbd.go
pkg/volume/rbd/rbd.go
+1
-0
testing.go
pkg/volume/testing/testing.go
+9
-0
attacher.go
pkg/volume/vsphere_volume/attacher.go
+15
-0
No files found.
pkg/controller/volume/attachdetach/testing/testvolumespec.go
View file @
81e360d2
...
@@ -294,6 +294,10 @@ func (plugin *TestPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -294,6 +294,10 @@ func (plugin *TestPlugin) NewAttacher() (volume.Attacher, error) {
return
&
attacher
,
nil
return
&
attacher
,
nil
}
}
func
(
plugin
*
TestPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
TestPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
TestPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
detacher
:=
testPluginDetacher
{
detacher
:=
testPluginDetacher
{
detachedVolumeMap
:
plugin
.
detachedVolumeMap
,
detachedVolumeMap
:
plugin
.
detachedVolumeMap
,
...
@@ -302,6 +306,10 @@ func (plugin *TestPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -302,6 +306,10 @@ func (plugin *TestPlugin) NewDetacher() (volume.Detacher, error) {
return
&
detacher
,
nil
return
&
detacher
,
nil
}
}
func
(
plugin
*
TestPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
plugin
*
TestPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
TestPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
return
[]
string
{},
nil
return
[]
string
{},
nil
}
}
...
...
pkg/volume/aws_ebs/attacher.go
View file @
81e360d2
...
@@ -39,8 +39,12 @@ type awsElasticBlockStoreAttacher struct {
...
@@ -39,8 +39,12 @@ type awsElasticBlockStoreAttacher struct {
var
_
volume
.
Attacher
=
&
awsElasticBlockStoreAttacher
{}
var
_
volume
.
Attacher
=
&
awsElasticBlockStoreAttacher
{}
var
_
volume
.
DeviceMounter
=
&
awsElasticBlockStoreAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
awsElasticBlockStorePlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
awsElasticBlockStorePlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
awsElasticBlockStorePlugin
{}
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
awsCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
awsCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -53,6 +57,10 @@ func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error)
...
@@ -53,6 +57,10 @@ func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error)
},
nil
},
nil
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
...
@@ -236,6 +244,8 @@ type awsElasticBlockStoreDetacher struct {
...
@@ -236,6 +244,8 @@ type awsElasticBlockStoreDetacher struct {
var
_
volume
.
Detacher
=
&
awsElasticBlockStoreDetacher
{}
var
_
volume
.
Detacher
=
&
awsElasticBlockStoreDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
awsElasticBlockStoreDetacher
{}
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
awsCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
awsCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -248,6 +258,10 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
...
@@ -248,6 +258,10 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
},
nil
},
nil
}
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
aws
.
KubernetesVolumeID
(
path
.
Base
(
volumeName
))
volumeID
:=
aws
.
KubernetesVolumeID
(
path
.
Base
(
volumeName
))
...
...
pkg/volume/azure_dd/attacher.go
View file @
81e360d2
...
@@ -52,6 +52,9 @@ type azureDiskAttacher struct {
...
@@ -52,6 +52,9 @@ type azureDiskAttacher struct {
var
_
volume
.
Attacher
=
&
azureDiskAttacher
{}
var
_
volume
.
Attacher
=
&
azureDiskAttacher
{}
var
_
volume
.
Detacher
=
&
azureDiskDetacher
{}
var
_
volume
.
Detacher
=
&
azureDiskDetacher
{}
var
_
volume
.
DeviceMounter
=
&
azureDiskAttacher
{}
var
_
volume
.
DeviceUnmounter
=
&
azureDiskDetacher
{}
// acquire lock to get an lun number
// acquire lock to get an lun number
var
getLunMutex
=
keymutex
.
NewKeyMutex
()
var
getLunMutex
=
keymutex
.
NewKeyMutex
()
...
...
pkg/volume/azure_dd/azure_dd.go
View file @
81e360d2
...
@@ -71,6 +71,7 @@ var _ volume.ProvisionableVolumePlugin = &azureDataDiskPlugin{}
...
@@ -71,6 +71,7 @@ var _ volume.ProvisionableVolumePlugin = &azureDataDiskPlugin{}
var
_
volume
.
AttachableVolumePlugin
=
&
azureDataDiskPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
azureDataDiskPlugin
{}
var
_
volume
.
VolumePluginWithAttachLimits
=
&
azureDataDiskPlugin
{}
var
_
volume
.
VolumePluginWithAttachLimits
=
&
azureDataDiskPlugin
{}
var
_
volume
.
ExpandableVolumePlugin
=
&
azureDataDiskPlugin
{}
var
_
volume
.
ExpandableVolumePlugin
=
&
azureDataDiskPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
azureDataDiskPlugin
{}
const
(
const
(
azureDataDiskPluginName
=
"kubernetes.io/azure-disk"
azureDataDiskPluginName
=
"kubernetes.io/azure-disk"
...
@@ -268,3 +269,11 @@ func (plugin *azureDataDiskPlugin) GetDeviceMountRefs(deviceMountPath string) ([
...
@@ -268,3 +269,11 @@ func (plugin *azureDataDiskPlugin) GetDeviceMountRefs(deviceMountPath string) ([
m
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
m
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
return
m
.
GetMountRefs
(
deviceMountPath
)
return
m
.
GetMountRefs
(
deviceMountPath
)
}
}
func
(
plugin
*
azureDataDiskPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
azureDataDiskPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
pkg/volume/cinder/attacher.go
View file @
81e360d2
...
@@ -40,8 +40,12 @@ type cinderDiskAttacher struct {
...
@@ -40,8 +40,12 @@ type cinderDiskAttacher struct {
var
_
volume
.
Attacher
=
&
cinderDiskAttacher
{}
var
_
volume
.
Attacher
=
&
cinderDiskAttacher
{}
var
_
volume
.
DeviceMounter
=
&
cinderDiskAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
cinderPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
cinderPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
cinderPlugin
{}
const
(
const
(
probeVolumeInitDelay
=
1
*
time
.
Second
probeVolumeInitDelay
=
1
*
time
.
Second
probeVolumeFactor
=
2.0
probeVolumeFactor
=
2.0
...
@@ -67,6 +71,10 @@ func (plugin *cinderPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -67,6 +71,10 @@ func (plugin *cinderPlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
cinderPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
cinderPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
cinderPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
...
@@ -299,6 +307,8 @@ type cinderDiskDetacher struct {
...
@@ -299,6 +307,8 @@ type cinderDiskDetacher struct {
var
_
volume
.
Detacher
=
&
cinderDiskDetacher
{}
var
_
volume
.
Detacher
=
&
cinderDiskDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
cinderDiskDetacher
{}
func
(
plugin
*
cinderPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
cinderPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
cinder
,
err
:=
plugin
.
getCloudProvider
()
cinder
,
err
:=
plugin
.
getCloudProvider
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -310,6 +320,10 @@ func (plugin *cinderPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -310,6 +320,10 @@ func (plugin *cinderPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
cinderPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
detacher
*
cinderDiskDetacher
)
waitOperationFinished
(
volumeID
string
)
error
{
func
(
detacher
*
cinderDiskDetacher
)
waitOperationFinished
(
volumeID
string
)
error
{
backoff
:=
wait
.
Backoff
{
backoff
:=
wait
.
Backoff
{
Duration
:
operationFinishInitDelay
,
Duration
:
operationFinishInitDelay
,
...
...
pkg/volume/csi/csi_attacher.go
View file @
81e360d2
...
@@ -56,6 +56,8 @@ type csiAttacher struct {
...
@@ -56,6 +56,8 @@ type csiAttacher struct {
// volume.Attacher methods
// volume.Attacher methods
var
_
volume
.
Attacher
=
&
csiAttacher
{}
var
_
volume
.
Attacher
=
&
csiAttacher
{}
var
_
volume
.
DeviceMounter
=
&
csiAttacher
{}
func
(
c
*
csiAttacher
)
Attach
(
spec
*
volume
.
Spec
,
nodeName
types
.
NodeName
)
(
string
,
error
)
{
func
(
c
*
csiAttacher
)
Attach
(
spec
*
volume
.
Spec
,
nodeName
types
.
NodeName
)
(
string
,
error
)
{
if
spec
==
nil
{
if
spec
==
nil
{
glog
.
Error
(
log
(
"attacher.Attach missing volume.Spec"
))
glog
.
Error
(
log
(
"attacher.Attach missing volume.Spec"
))
...
@@ -373,6 +375,8 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
...
@@ -373,6 +375,8 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo
var
_
volume
.
Detacher
=
&
csiAttacher
{}
var
_
volume
.
Detacher
=
&
csiAttacher
{}
var
_
volume
.
DeviceUnmounter
=
&
csiAttacher
{}
func
(
c
*
csiAttacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
c
*
csiAttacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
// volumeName in format driverName<SEP>volumeHandle generated by plugin.GetVolumeName()
// volumeName in format driverName<SEP>volumeHandle generated by plugin.GetVolumeName()
if
volumeName
==
""
{
if
volumeName
==
""
{
...
...
pkg/volume/csi/csi_plugin.go
View file @
81e360d2
...
@@ -280,6 +280,8 @@ func (p *csiPlugin) SupportsBulkVolumeVerification() bool {
...
@@ -280,6 +280,8 @@ func (p *csiPlugin) SupportsBulkVolumeVerification() bool {
// volume.AttachableVolumePlugin methods
// volume.AttachableVolumePlugin methods
var
_
volume
.
AttachableVolumePlugin
=
&
csiPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
csiPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
csiPlugin
{}
func
(
p
*
csiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
p
*
csiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
k8s
:=
p
.
host
.
GetKubeClient
()
k8s
:=
p
.
host
.
GetKubeClient
()
if
k8s
==
nil
{
if
k8s
==
nil
{
...
@@ -294,6 +296,10 @@ func (p *csiPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -294,6 +296,10 @@ func (p *csiPlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
p
*
csiPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
p
.
NewAttacher
()
}
func
(
p
*
csiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
p
*
csiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
k8s
:=
p
.
host
.
GetKubeClient
()
k8s
:=
p
.
host
.
GetKubeClient
()
if
k8s
==
nil
{
if
k8s
==
nil
{
...
@@ -308,6 +314,10 @@ func (p *csiPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -308,6 +314,10 @@ func (p *csiPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
p
*
csiPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
p
.
NewDetacher
()
}
func
(
p
*
csiPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
p
*
csiPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
m
:=
p
.
host
.
GetMounter
(
p
.
GetPluginName
())
m
:=
p
.
host
.
GetMounter
(
p
.
GetPluginName
())
return
m
.
GetMountRefs
(
deviceMountPath
)
return
m
.
GetMountRefs
(
deviceMountPath
)
...
...
pkg/volume/fc/attacher.go
View file @
81e360d2
...
@@ -40,8 +40,12 @@ type fcAttacher struct {
...
@@ -40,8 +40,12 @@ type fcAttacher struct {
var
_
volume
.
Attacher
=
&
fcAttacher
{}
var
_
volume
.
Attacher
=
&
fcAttacher
{}
var
_
volume
.
DeviceMounter
=
&
fcAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
fcPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
fcPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
fcPlugin
{}
func
(
plugin
*
fcPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
fcPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
return
&
fcAttacher
{
return
&
fcAttacher
{
host
:
plugin
.
host
,
host
:
plugin
.
host
,
...
@@ -49,6 +53,10 @@ func (plugin *fcPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -49,6 +53,10 @@ func (plugin *fcPlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
fcPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
fcPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
fcPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
...
@@ -129,6 +137,8 @@ type fcDetacher struct {
...
@@ -129,6 +137,8 @@ type fcDetacher struct {
var
_
volume
.
Detacher
=
&
fcDetacher
{}
var
_
volume
.
Detacher
=
&
fcDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
fcDetacher
{}
func
(
plugin
*
fcPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
fcPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
return
&
fcDetacher
{
return
&
fcDetacher
{
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()),
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()),
...
@@ -136,6 +146,10 @@ func (plugin *fcPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -136,6 +146,10 @@ func (plugin *fcPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
fcPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
detacher
*
fcDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
fcDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
return
nil
return
nil
}
}
...
...
pkg/volume/flexvolume/attacher.go
View file @
81e360d2
...
@@ -31,6 +31,8 @@ type flexVolumeAttacher struct {
...
@@ -31,6 +31,8 @@ type flexVolumeAttacher struct {
var
_
volume
.
Attacher
=
&
flexVolumeAttacher
{}
var
_
volume
.
Attacher
=
&
flexVolumeAttacher
{}
var
_
volume
.
DeviceMounter
=
&
flexVolumeAttacher
{}
// Attach is part of the volume.Attacher interface
// Attach is part of the volume.Attacher interface
func
(
a
*
flexVolumeAttacher
)
Attach
(
spec
*
volume
.
Spec
,
hostName
types
.
NodeName
)
(
string
,
error
)
{
func
(
a
*
flexVolumeAttacher
)
Attach
(
spec
*
volume
.
Spec
,
hostName
types
.
NodeName
)
(
string
,
error
)
{
...
...
pkg/volume/flexvolume/detacher.go
View file @
81e360d2
...
@@ -32,6 +32,8 @@ type flexVolumeDetacher struct {
...
@@ -32,6 +32,8 @@ type flexVolumeDetacher struct {
var
_
volume
.
Detacher
=
&
flexVolumeDetacher
{}
var
_
volume
.
Detacher
=
&
flexVolumeDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
flexVolumeDetacher
{}
// Detach is part of the volume.Detacher interface.
// Detach is part of the volume.Detacher interface.
func
(
d
*
flexVolumeDetacher
)
Detach
(
volumeName
string
,
hostName
types
.
NodeName
)
error
{
func
(
d
*
flexVolumeDetacher
)
Detach
(
volumeName
string
,
hostName
types
.
NodeName
)
error
{
...
...
pkg/volume/flexvolume/plugin.go
View file @
81e360d2
...
@@ -58,6 +58,8 @@ type flexVolumeAttachablePlugin struct {
...
@@ -58,6 +58,8 @@ type flexVolumeAttachablePlugin struct {
var
_
volume
.
AttachableVolumePlugin
=
&
flexVolumeAttachablePlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
flexVolumeAttachablePlugin
{}
var
_
volume
.
PersistentVolumePlugin
=
&
flexVolumePlugin
{}
var
_
volume
.
PersistentVolumePlugin
=
&
flexVolumePlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
flexVolumeAttachablePlugin
{}
type
PluginFactory
interface
{
type
PluginFactory
interface
{
NewFlexVolumePlugin
(
pluginDir
,
driverName
string
,
runner
exec
.
Interface
)
(
volume
.
VolumePlugin
,
error
)
NewFlexVolumePlugin
(
pluginDir
,
driverName
string
,
runner
exec
.
Interface
)
(
volume
.
VolumePlugin
,
error
)
}
}
...
@@ -218,11 +220,19 @@ func (plugin *flexVolumeAttachablePlugin) NewAttacher() (volume.Attacher, error)
...
@@ -218,11 +220,19 @@ func (plugin *flexVolumeAttachablePlugin) NewAttacher() (volume.Attacher, error)
return
&
flexVolumeAttacher
{
plugin
},
nil
return
&
flexVolumeAttacher
{
plugin
},
nil
}
}
func
(
plugin
*
flexVolumeAttachablePlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
// NewDetacher is part of the volume.AttachableVolumePlugin interface.
// NewDetacher is part of the volume.AttachableVolumePlugin interface.
func
(
plugin
*
flexVolumeAttachablePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
flexVolumeAttachablePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
return
&
flexVolumeDetacher
{
plugin
},
nil
return
&
flexVolumeDetacher
{
plugin
},
nil
}
}
func
(
plugin
*
flexVolumeAttachablePlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
// ConstructVolumeSpec is part of the volume.AttachableVolumePlugin interface.
// ConstructVolumeSpec is part of the volume.AttachableVolumePlugin interface.
func
(
plugin
*
flexVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
func
(
plugin
*
flexVolumePlugin
)
ConstructVolumeSpec
(
volumeName
,
mountPath
string
)
(
*
volume
.
Spec
,
error
)
{
flexVolume
:=
&
api
.
Volume
{
flexVolume
:=
&
api
.
Volume
{
...
...
pkg/volume/gce_pd/attacher.go
View file @
81e360d2
...
@@ -40,8 +40,12 @@ type gcePersistentDiskAttacher struct {
...
@@ -40,8 +40,12 @@ type gcePersistentDiskAttacher struct {
var
_
volume
.
Attacher
=
&
gcePersistentDiskAttacher
{}
var
_
volume
.
Attacher
=
&
gcePersistentDiskAttacher
{}
var
_
volume
.
DeviceMounter
=
&
gcePersistentDiskAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
gcePersistentDiskPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
gcePersistentDiskPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
gcePersistentDiskPlugin
{}
func
(
plugin
*
gcePersistentDiskPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
gceCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
gceCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -54,6 +58,10 @@ func (plugin *gcePersistentDiskPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -54,6 +58,10 @@ func (plugin *gcePersistentDiskPlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
gcePersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
mounter
:=
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
())
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
...
@@ -226,6 +234,8 @@ type gcePersistentDiskDetacher struct {
...
@@ -226,6 +234,8 @@ type gcePersistentDiskDetacher struct {
var
_
volume
.
Detacher
=
&
gcePersistentDiskDetacher
{}
var
_
volume
.
Detacher
=
&
gcePersistentDiskDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
gcePersistentDiskDetacher
{}
func
(
plugin
*
gcePersistentDiskPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
gcePersistentDiskPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
gceCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
gceCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -238,6 +248,10 @@ func (plugin *gcePersistentDiskPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -238,6 +248,10 @@ func (plugin *gcePersistentDiskPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
gcePersistentDiskPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
// Detach checks with the GCE cloud provider if the specified volume is already
// Detach checks with the GCE cloud provider if the specified volume is already
// attached to the specified node. If the volume is not attached, it succeeds
// attached to the specified node. If the volume is not attached, it succeeds
// (returns nil). If it is attached, Detach issues a call to the GCE cloud
// (returns nil). If it is attached, Detach issues a call to the GCE cloud
...
...
pkg/volume/iscsi/attacher.go
View file @
81e360d2
...
@@ -40,8 +40,12 @@ type iscsiAttacher struct {
...
@@ -40,8 +40,12 @@ type iscsiAttacher struct {
var
_
volume
.
Attacher
=
&
iscsiAttacher
{}
var
_
volume
.
Attacher
=
&
iscsiAttacher
{}
var
_
volume
.
DeviceMounter
=
&
iscsiAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
iscsiPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
iscsiPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
iscsiPlugin
{}
func
(
plugin
*
iscsiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
return
&
iscsiAttacher
{
return
&
iscsiAttacher
{
host
:
plugin
.
host
,
host
:
plugin
.
host
,
...
@@ -50,6 +54,10 @@ func (plugin *iscsiPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -50,6 +54,10 @@ func (plugin *iscsiPlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
iscsiPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
iscsiPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
GetDeviceMountRefs
(
deviceMountPath
string
)
([]
string
,
error
)
{
mounter
:=
plugin
.
host
.
GetMounter
(
iscsiPluginName
)
mounter
:=
plugin
.
host
.
GetMounter
(
iscsiPluginName
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
return
mounter
.
GetMountRefs
(
deviceMountPath
)
...
@@ -133,6 +141,8 @@ type iscsiDetacher struct {
...
@@ -133,6 +141,8 @@ type iscsiDetacher struct {
var
_
volume
.
Detacher
=
&
iscsiDetacher
{}
var
_
volume
.
Detacher
=
&
iscsiDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
iscsiDetacher
{}
func
(
plugin
*
iscsiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
iscsiPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
return
&
iscsiDetacher
{
return
&
iscsiDetacher
{
host
:
plugin
.
host
,
host
:
plugin
.
host
,
...
@@ -141,6 +151,10 @@ func (plugin *iscsiPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -141,6 +151,10 @@ func (plugin *iscsiPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
iscsiPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
detacher
*
iscsiDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
iscsiDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
return
nil
return
nil
}
}
...
...
pkg/volume/photon_pd/attacher.go
View file @
81e360d2
...
@@ -40,8 +40,13 @@ type photonPersistentDiskAttacher struct {
...
@@ -40,8 +40,13 @@ type photonPersistentDiskAttacher struct {
}
}
var
_
volume
.
Attacher
=
&
photonPersistentDiskAttacher
{}
var
_
volume
.
Attacher
=
&
photonPersistentDiskAttacher
{}
var
_
volume
.
DeviceMounter
=
&
photonPersistentDiskAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
photonPersistentDiskPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
photonPersistentDiskPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
photonPersistentDiskPlugin
{}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
NewAttacher
()
(
volume
.
Attacher
,
error
)
{
photonCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
photonCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -55,6 +60,10 @@ func (plugin *photonPersistentDiskPlugin) NewAttacher() (volume.Attacher, error)
...
@@ -55,6 +60,10 @@ func (plugin *photonPersistentDiskPlugin) NewAttacher() (volume.Attacher, error)
},
nil
},
nil
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
// Attaches the volume specified by the given spec to the given host.
// Attaches the volume specified by the given spec to the given host.
// On success, returns the device path where the device was attached on the
// On success, returns the device path where the device was attached on the
// node.
// node.
...
@@ -229,6 +238,8 @@ type photonPersistentDiskDetacher struct {
...
@@ -229,6 +238,8 @@ type photonPersistentDiskDetacher struct {
var
_
volume
.
Detacher
=
&
photonPersistentDiskDetacher
{}
var
_
volume
.
Detacher
=
&
photonPersistentDiskDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
photonPersistentDiskDetacher
{}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
photonPersistentDiskPlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
photonCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
photonCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -242,6 +253,10 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error)
...
@@ -242,6 +253,10 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error)
},
nil
},
nil
}
}
func
(
plugin
*
photonPersistentDiskPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
// Detach the given device from the given host.
// Detach the given device from the given host.
func
(
detacher
*
photonPersistentDiskDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
photonPersistentDiskDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
...
...
pkg/volume/rbd/attacher.go
View file @
81e360d2
...
@@ -34,6 +34,11 @@ func (plugin *rbdPlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -34,6 +34,11 @@ func (plugin *rbdPlugin) NewAttacher() (volume.Attacher, error) {
return
plugin
.
newAttacherInternal
(
&
RBDUtil
{})
return
plugin
.
newAttacherInternal
(
&
RBDUtil
{})
}
}
// NewDeviceMounter implements DeviceMountableVolumePlugin.NewDeviceMounter
func
(
plugin
*
rbdPlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
rbdPlugin
)
newAttacherInternal
(
manager
diskManager
)
(
volume
.
Attacher
,
error
)
{
func
(
plugin
*
rbdPlugin
)
newAttacherInternal
(
manager
diskManager
)
(
volume
.
Attacher
,
error
)
{
return
&
rbdAttacher
{
return
&
rbdAttacher
{
plugin
:
plugin
,
plugin
:
plugin
,
...
@@ -47,6 +52,11 @@ func (plugin *rbdPlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -47,6 +52,11 @@ func (plugin *rbdPlugin) NewDetacher() (volume.Detacher, error) {
return
plugin
.
newDetacherInternal
(
&
RBDUtil
{})
return
plugin
.
newDetacherInternal
(
&
RBDUtil
{})
}
}
// NewDeviceUnmounter implements DeviceMountableVolumePlugin.NewDeviceUnmounter
func
(
plugin
*
rbdPlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
plugin
*
rbdPlugin
)
newDetacherInternal
(
manager
diskManager
)
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
rbdPlugin
)
newDetacherInternal
(
manager
diskManager
)
(
volume
.
Detacher
,
error
)
{
return
&
rbdDetacher
{
return
&
rbdDetacher
{
plugin
:
plugin
,
plugin
:
plugin
,
...
@@ -70,6 +80,8 @@ type rbdAttacher struct {
...
@@ -70,6 +80,8 @@ type rbdAttacher struct {
var
_
volume
.
Attacher
=
&
rbdAttacher
{}
var
_
volume
.
Attacher
=
&
rbdAttacher
{}
var
_
volume
.
DeviceMounter
=
&
rbdAttacher
{}
// Attach implements Attacher.Attach.
// Attach implements Attacher.Attach.
// We do not lock image here, because it requires kube-controller-manager to
// We do not lock image here, because it requires kube-controller-manager to
// access external `rbd` utility. And there is no need since AttachDetach
// access external `rbd` utility. And there is no need since AttachDetach
...
@@ -172,6 +184,8 @@ type rbdDetacher struct {
...
@@ -172,6 +184,8 @@ type rbdDetacher struct {
var
_
volume
.
Detacher
=
&
rbdDetacher
{}
var
_
volume
.
Detacher
=
&
rbdDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
rbdDetacher
{}
// UnmountDevice implements Detacher.UnmountDevice. It unmounts the global
// UnmountDevice implements Detacher.UnmountDevice. It unmounts the global
// mount of the RBD image. This is called once all bind mounts have been
// mount of the RBD image. This is called once all bind mounts have been
// unmounted.
// unmounted.
...
...
pkg/volume/rbd/rbd.go
View file @
81e360d2
...
@@ -61,6 +61,7 @@ var _ volume.ProvisionableVolumePlugin = &rbdPlugin{}
...
@@ -61,6 +61,7 @@ var _ volume.ProvisionableVolumePlugin = &rbdPlugin{}
var
_
volume
.
AttachableVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
ExpandableVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
ExpandableVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
BlockVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
BlockVolumePlugin
=
&
rbdPlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
rbdPlugin
{}
const
(
const
(
rbdPluginName
=
"kubernetes.io/rbd"
rbdPluginName
=
"kubernetes.io/rbd"
...
...
pkg/volume/testing/testing.go
View file @
81e360d2
...
@@ -242,6 +242,7 @@ var _ DeletableVolumePlugin = &FakeVolumePlugin{}
...
@@ -242,6 +242,7 @@ var _ DeletableVolumePlugin = &FakeVolumePlugin{}
var
_
ProvisionableVolumePlugin
=
&
FakeVolumePlugin
{}
var
_
ProvisionableVolumePlugin
=
&
FakeVolumePlugin
{}
var
_
AttachableVolumePlugin
=
&
FakeVolumePlugin
{}
var
_
AttachableVolumePlugin
=
&
FakeVolumePlugin
{}
var
_
VolumePluginWithAttachLimits
=
&
FakeVolumePlugin
{}
var
_
VolumePluginWithAttachLimits
=
&
FakeVolumePlugin
{}
var
_
DeviceMountableVolumePlugin
=
&
FakeVolumePlugin
{}
func
(
plugin
*
FakeVolumePlugin
)
getFakeVolume
(
list
*
[]
*
FakeVolume
)
*
FakeVolume
{
func
(
plugin
*
FakeVolumePlugin
)
getFakeVolume
(
list
*
[]
*
FakeVolume
)
*
FakeVolume
{
volume
:=
&
FakeVolume
{}
volume
:=
&
FakeVolume
{}
...
@@ -372,6 +373,10 @@ func (plugin *FakeVolumePlugin) NewAttacher() (Attacher, error) {
...
@@ -372,6 +373,10 @@ func (plugin *FakeVolumePlugin) NewAttacher() (Attacher, error) {
return
plugin
.
getFakeVolume
(
&
plugin
.
Attachers
),
nil
return
plugin
.
getFakeVolume
(
&
plugin
.
Attachers
),
nil
}
}
func
(
plugin
*
FakeVolumePlugin
)
NewDeviceMounter
()
(
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
func
(
plugin
*
FakeVolumePlugin
)
GetAttachers
()
(
Attachers
[]
*
FakeVolume
)
{
func
(
plugin
*
FakeVolumePlugin
)
GetAttachers
()
(
Attachers
[]
*
FakeVolume
)
{
plugin
.
RLock
()
plugin
.
RLock
()
defer
plugin
.
RUnlock
()
defer
plugin
.
RUnlock
()
...
@@ -391,6 +396,10 @@ func (plugin *FakeVolumePlugin) NewDetacher() (Detacher, error) {
...
@@ -391,6 +396,10 @@ func (plugin *FakeVolumePlugin) NewDetacher() (Detacher, error) {
return
plugin
.
getFakeVolume
(
&
plugin
.
Detachers
),
nil
return
plugin
.
getFakeVolume
(
&
plugin
.
Detachers
),
nil
}
}
func
(
plugin
*
FakeVolumePlugin
)
NewDeviceUnmounter
()
(
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
func
(
plugin
*
FakeVolumePlugin
)
GetDetachers
()
(
Detachers
[]
*
FakeVolume
)
{
func
(
plugin
*
FakeVolumePlugin
)
GetDetachers
()
(
Detachers
[]
*
FakeVolume
)
{
plugin
.
RLock
()
plugin
.
RLock
()
defer
plugin
.
RUnlock
()
defer
plugin
.
RUnlock
()
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
81e360d2
...
@@ -38,8 +38,13 @@ type vsphereVMDKAttacher struct {
...
@@ -38,8 +38,13 @@ type vsphereVMDKAttacher struct {
}
}
var
_
volume
.
Attacher
=
&
vsphereVMDKAttacher
{}
var
_
volume
.
Attacher
=
&
vsphereVMDKAttacher
{}
var
_
volume
.
DeviceMounter
=
&
vsphereVMDKAttacher
{}
var
_
volume
.
AttachableVolumePlugin
=
&
vsphereVolumePlugin
{}
var
_
volume
.
AttachableVolumePlugin
=
&
vsphereVolumePlugin
{}
var
_
volume
.
DeviceMountableVolumePlugin
=
&
vsphereVolumePlugin
{}
// Singleton key mutex for keeping attach operations for the same host atomic
// Singleton key mutex for keeping attach operations for the same host atomic
var
attachdetachMutex
=
keymutex
.
NewKeyMutex
()
var
attachdetachMutex
=
keymutex
.
NewKeyMutex
()
...
@@ -55,6 +60,10 @@ func (plugin *vsphereVolumePlugin) NewAttacher() (volume.Attacher, error) {
...
@@ -55,6 +60,10 @@ func (plugin *vsphereVolumePlugin) NewAttacher() (volume.Attacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
vsphereVolumePlugin
)
NewDeviceMounter
()
(
volume
.
DeviceMounter
,
error
)
{
return
plugin
.
NewAttacher
()
}
// Attaches the volume specified by the given spec to the given host.
// Attaches the volume specified by the given spec to the given host.
// On success, returns the device path where the device was attached on the
// On success, returns the device path where the device was attached on the
// node.
// node.
...
@@ -237,6 +246,8 @@ type vsphereVMDKDetacher struct {
...
@@ -237,6 +246,8 @@ type vsphereVMDKDetacher struct {
var
_
volume
.
Detacher
=
&
vsphereVMDKDetacher
{}
var
_
volume
.
Detacher
=
&
vsphereVMDKDetacher
{}
var
_
volume
.
DeviceUnmounter
=
&
vsphereVMDKDetacher
{}
func
(
plugin
*
vsphereVolumePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
func
(
plugin
*
vsphereVolumePlugin
)
NewDetacher
()
(
volume
.
Detacher
,
error
)
{
vsphereCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
vsphereCloud
,
err
:=
getCloudProvider
(
plugin
.
host
.
GetCloudProvider
())
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -249,6 +260,10 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) {
...
@@ -249,6 +260,10 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) {
},
nil
},
nil
}
}
func
(
plugin
*
vsphereVolumePlugin
)
NewDeviceUnmounter
()
(
volume
.
DeviceUnmounter
,
error
)
{
return
plugin
.
NewDetacher
()
}
// Detach the given device from the given node.
// Detach the given device from the given node.
func
(
detacher
*
vsphereVMDKDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
vsphereVMDKDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
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