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
6f160c35
Commit
6f160c35
authored
Oct 31, 2017
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Detach() parameter.
Detach() does not get device name, it gets volume name.
parent
eb658d69
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
24 additions
and
22 deletions
+24
-22
attacher.go
pkg/volume/aws_ebs/attacher.go
+2
-2
attacher.go
pkg/volume/cinder/attacher.go
+2
-2
attacher.go
pkg/volume/fc/attacher.go
+1
-1
detacher-defaults.go
pkg/volume/flexvolume/detacher-defaults.go
+2
-2
detacher.go
pkg/volume/flexvolume/detacher.go
+3
-3
attacher.go
pkg/volume/gce_pd/attacher.go
+2
-2
attacher.go
pkg/volume/iscsi/attacher.go
+1
-1
attacher.go
pkg/volume/photon_pd/attacher.go
+2
-2
attacher.go
pkg/volume/rbd/attacher.go
+1
-1
testing.go
pkg/volume/testing/testing.go
+1
-1
volume.go
pkg/volume/volume.go
+4
-2
attacher.go
pkg/volume/vsphere_volume/attacher.go
+2
-2
vsphere_volume_util.go
pkg/volume/vsphere_volume/vsphere_volume_util.go
+1
-1
No files found.
pkg/volume/aws_ebs/attacher.go
View file @
6f160c35
...
...
@@ -253,8 +253,8 @@ func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error)
},
nil
}
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
aws
.
KubernetesVolumeID
(
path
.
Base
(
deviceMountPath
))
func
(
detacher
*
awsElasticBlockStoreDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
aws
.
KubernetesVolumeID
(
path
.
Base
(
volumeName
))
attached
,
err
:=
detacher
.
awsVolumes
.
DiskIsAttached
(
volumeID
,
nodeName
)
if
err
!=
nil
{
...
...
pkg/volume/cinder/attacher.go
View file @
6f160c35
...
...
@@ -374,8 +374,8 @@ func (detacher *cinderDiskDetacher) waitDiskDetached(instanceID, volumeID string
return
err
}
func
(
detacher
*
cinderDiskDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
path
.
Base
(
deviceMountPath
)
func
(
detacher
*
cinderDiskDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
volumeID
:=
path
.
Base
(
volumeName
)
instances
,
res
:=
detacher
.
cinderProvider
.
Instances
()
if
!
res
{
return
fmt
.
Errorf
(
"failed to list openstack instances"
)
...
...
pkg/volume/fc/attacher.go
View file @
6f160c35
...
...
@@ -135,7 +135,7 @@ func (plugin *fcPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
}
func
(
detacher
*
fcDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
fcDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
return
nil
}
...
...
pkg/volume/flexvolume/detacher-defaults.go
View file @
6f160c35
...
...
@@ -27,8 +27,8 @@ import (
type
detacherDefaults
flexVolumeDetacher
// Detach is part of the volume.Detacher interface.
func
(
d
*
detacherDefaults
)
Detach
(
devic
eName
string
,
hostName
types
.
NodeName
)
error
{
glog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default Detach for
device "
,
devic
eName
,
", host "
,
hostName
)
func
(
d
*
detacherDefaults
)
Detach
(
volum
eName
string
,
hostName
types
.
NodeName
)
error
{
glog
.
Warning
(
logPrefix
(
d
.
plugin
.
flexVolumePlugin
),
"using default Detach for
volume "
,
volum
eName
,
", host "
,
hostName
)
return
nil
}
...
...
pkg/volume/flexvolume/detacher.go
View file @
6f160c35
...
...
@@ -34,15 +34,15 @@ type flexVolumeDetacher struct {
var
_
volume
.
Detacher
=
&
flexVolumeDetacher
{}
// Detach is part of the volume.Detacher interface.
func
(
d
*
flexVolumeDetacher
)
Detach
(
pvOrV
olumeName
string
,
hostName
types
.
NodeName
)
error
{
func
(
d
*
flexVolumeDetacher
)
Detach
(
v
olumeName
string
,
hostName
types
.
NodeName
)
error
{
call
:=
d
.
plugin
.
NewDriverCall
(
detachCmd
)
call
.
Append
(
pvOrV
olumeName
)
call
.
Append
(
v
olumeName
)
call
.
Append
(
string
(
hostName
))
_
,
err
:=
call
.
Run
()
if
isCmdNotSupportedErr
(
err
)
{
return
(
*
detacherDefaults
)(
d
)
.
Detach
(
pvOrV
olumeName
,
hostName
)
return
(
*
detacherDefaults
)(
d
)
.
Detach
(
v
olumeName
,
hostName
)
}
return
err
}
...
...
pkg/volume/gce_pd/attacher.go
View file @
6f160c35
...
...
@@ -247,8 +247,8 @@ func (plugin *gcePersistentDiskPlugin) NewDetacher() (volume.Detacher, error) {
// Callers are responsible for retrying on failure.
// Callers are responsible for thread safety between concurrent attach and detach
// operations.
func
(
detacher
*
gcePersistentDiskDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
pdName
:=
path
.
Base
(
deviceMountPath
)
func
(
detacher
*
gcePersistentDiskDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
pdName
:=
path
.
Base
(
volumeName
)
attached
,
err
:=
detacher
.
gceDisks
.
DiskIsAttached
(
pdName
,
nodeName
)
if
err
!=
nil
{
...
...
pkg/volume/iscsi/attacher.go
View file @
6f160c35
...
...
@@ -137,7 +137,7 @@ func (plugin *iscsiPlugin) NewDetacher() (volume.Detacher, error) {
},
nil
}
func
(
detacher
*
iscsiDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
iscsiDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
return
nil
}
...
...
pkg/volume/photon_pd/attacher.go
View file @
6f160c35
...
...
@@ -243,10 +243,10 @@ func (plugin *photonPersistentDiskPlugin) NewDetacher() (volume.Detacher, error)
}
// Detach the given device from the given host.
func
(
detacher
*
photonPersistentDiskDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
photonPersistentDiskDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
hostName
:=
string
(
nodeName
)
pdID
:=
deviceMountPath
pdID
:=
volumeName
attached
,
err
:=
detacher
.
photonDisks
.
DiskIsAttached
(
pdID
,
nodeName
)
if
err
!=
nil
{
// Log error and continue with detach
...
...
pkg/volume/rbd/attacher.go
View file @
6f160c35
...
...
@@ -220,6 +220,6 @@ func (detacher *rbdDetacher) UnmountDevice(deviceMountPath string) error {
}
// Detach implements Detacher.Detach.
func
(
detacher
*
rbdDetacher
)
Detach
(
devic
eName
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
rbdDetacher
)
Detach
(
volum
eName
string
,
nodeName
types
.
NodeName
)
error
{
return
nil
}
pkg/volume/testing/testing.go
View file @
6f160c35
...
...
@@ -468,7 +468,7 @@ func (fv *FakeVolume) GetMountDeviceCallCount() int {
return
fv
.
MountDeviceCallCount
}
func
(
fv
*
FakeVolume
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
func
(
fv
*
FakeVolume
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
fv
.
Lock
()
defer
fv
.
Unlock
()
fv
.
DetachCallCount
++
...
...
pkg/volume/volume.go
View file @
6f160c35
...
...
@@ -195,8 +195,10 @@ type BulkVolumeVerifier interface {
// Detacher can detach a volume from a node.
type
Detacher
interface
{
// Detach the given device from the node with the given Name.
Detach
(
deviceName
string
,
nodeName
types
.
NodeName
)
error
// Detach the given volume from the node with the given Name.
// volumeName is name of the volume as returned from plugin's
// GetVolumeName().
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
// UnmountDevice unmounts the global mount of the disk. This
// should only be called once all bind mounts have been
...
...
pkg/volume/vsphere_volume/attacher.go
View file @
6f160c35
...
...
@@ -251,9 +251,9 @@ func (plugin *vsphereVolumePlugin) NewDetacher() (volume.Detacher, error) {
}
// Detach the given device from the given node.
func
(
detacher
*
vsphereVMDKDetacher
)
Detach
(
deviceMountPath
string
,
nodeName
types
.
NodeName
)
error
{
func
(
detacher
*
vsphereVMDKDetacher
)
Detach
(
volumeName
string
,
nodeName
types
.
NodeName
)
error
{
volPath
:=
getVolPathfrom
DeviceMountPath
(
deviceMountPath
)
volPath
:=
getVolPathfrom
VolumeName
(
volumeName
)
attached
,
err
:=
detacher
.
vsphereVolumes
.
DiskIsAttached
(
volPath
,
nodeName
)
if
err
!=
nil
{
// Log error and continue with detach
...
...
pkg/volume/vsphere_volume/vsphere_volume_util.go
View file @
6f160c35
...
...
@@ -170,7 +170,7 @@ func (util *VsphereDiskUtil) DeleteVolume(vd *vsphereVolumeDeleter) error {
return
nil
}
func
getVolPathfrom
DeviceMountPath
(
deviceMountPath
string
)
string
{
func
getVolPathfrom
VolumeName
(
deviceMountPath
string
)
string
{
// Assumption: No file or folder is named starting with '[' in datastore
volPath
:=
deviceMountPath
[
strings
.
LastIndex
(
deviceMountPath
,
"["
)
:
]
// space between datastore and vmdk name in volumePath is encoded as '\040' when returned by GetMountRefs().
...
...
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