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
ab6a2530
Commit
ab6a2530
authored
Mar 27, 2019
by
Michelle Au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return empty devicepath for csi attach
parent
0f4b55bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
15 deletions
+12
-15
csi_attacher.go
pkg/volume/csi/csi_attacher.go
+3
-3
csi_attacher_test.go
pkg/volume/csi/csi_attacher_test.go
+9
-12
No files found.
pkg/volume/csi/csi_attacher.go
View file @
ab6a2530
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
"k8s.io/klog"
"k8s.io/klog"
"k8s.io/api/core/v1"
v1
"k8s.io/api/core/v1"
storage
"k8s.io/api/storage/v1"
storage
"k8s.io/api/storage/v1"
apierrs
"k8s.io/apimachinery/pkg/api/errors"
apierrs
"k8s.io/apimachinery/pkg/api/errors"
meta
"k8s.io/apimachinery/pkg/apis/meta/v1"
meta
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -108,8 +108,8 @@ func (c *csiAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string
...
@@ -108,8 +108,8 @@ func (c *csiAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string
klog
.
V
(
4
)
.
Info
(
log
(
"attacher.Attach finished OK with VolumeAttachment object [%s]"
,
attachID
))
klog
.
V
(
4
)
.
Info
(
log
(
"attacher.Attach finished OK with VolumeAttachment object [%s]"
,
attachID
))
//
TODO(71164): In 1.15, return empty devicePath
//
Don't return attachID as a devicePath. We can reconstruct the attachID using getAttachmentName()
return
attachID
,
nil
return
""
,
nil
}
}
func
(
c
*
csiAttacher
)
WaitForAttach
(
spec
*
volume
.
Spec
,
_
string
,
pod
*
v1
.
Pod
,
timeout
time
.
Duration
)
(
string
,
error
)
{
func
(
c
*
csiAttacher
)
WaitForAttach
(
spec
*
volume
.
Spec
,
_
string
,
pod
*
v1
.
Pod
,
timeout
time
.
Duration
)
(
string
,
error
)
{
...
...
pkg/volume/csi/csi_attacher_test.go
View file @
ab6a2530
...
@@ -198,7 +198,7 @@ func TestAttacherAttach(t *testing.T) {
...
@@ -198,7 +198,7 @@ func TestAttacherAttach(t *testing.T) {
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
go
func
(
spec
*
volume
.
Spec
,
id
,
nodename
string
,
fail
bool
)
{
go
func
(
spec
*
volume
.
Spec
,
nodename
string
,
fail
bool
)
{
attachID
,
err
:=
csiAttacher
.
Attach
(
spec
,
types
.
NodeName
(
nodename
))
attachID
,
err
:=
csiAttacher
.
Attach
(
spec
,
types
.
NodeName
(
nodename
))
if
!
fail
&&
err
!=
nil
{
if
!
fail
&&
err
!=
nil
{
t
.
Errorf
(
"expecting no failure, but got err: %v"
,
err
)
t
.
Errorf
(
"expecting no failure, but got err: %v"
,
err
)
...
@@ -206,10 +206,10 @@ func TestAttacherAttach(t *testing.T) {
...
@@ -206,10 +206,10 @@ func TestAttacherAttach(t *testing.T) {
if
fail
&&
err
==
nil
{
if
fail
&&
err
==
nil
{
t
.
Errorf
(
"expecting failure, but got no err"
)
t
.
Errorf
(
"expecting failure, but got no err"
)
}
}
if
attachID
!=
id
&&
!
fail
{
if
attachID
!=
""
{
t
.
Errorf
(
"expecting
attachID %v, got %v"
,
id
,
attachID
)
t
.
Errorf
(
"expecting
empty attachID, got %v"
,
attachID
)
}
}
}(
tc
.
spec
,
tc
.
attachID
,
tc
.
nodeName
,
tc
.
shouldFail
)
}(
tc
.
spec
,
tc
.
nodeName
,
tc
.
shouldFail
)
var
status
storage
.
VolumeAttachmentStatus
var
status
storage
.
VolumeAttachmentStatus
if
tc
.
injectAttacherError
{
if
tc
.
injectAttacherError
{
...
@@ -277,15 +277,15 @@ func TestAttacherAttachWithInline(t *testing.T) {
...
@@ -277,15 +277,15 @@ func TestAttacherAttachWithInline(t *testing.T) {
}
}
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
csiAttacher
:=
attacher
.
(
*
csiAttacher
)
go
func
(
spec
*
volume
.
Spec
,
id
,
nodename
string
,
fail
bool
)
{
go
func
(
spec
*
volume
.
Spec
,
nodename
string
,
fail
bool
)
{
attachID
,
err
:=
csiAttacher
.
Attach
(
spec
,
types
.
NodeName
(
nodename
))
attachID
,
err
:=
csiAttacher
.
Attach
(
spec
,
types
.
NodeName
(
nodename
))
if
fail
!=
(
err
!=
nil
)
{
if
fail
!=
(
err
!=
nil
)
{
t
.
Errorf
(
"expecting no failure, but got err: %v"
,
err
)
t
.
Errorf
(
"expecting no failure, but got err: %v"
,
err
)
}
}
if
attachID
!=
id
&&
!
fail
{
if
attachID
!=
""
{
t
.
Errorf
(
"expecting
attachID %v, got %v"
,
id
,
attachID
)
t
.
Errorf
(
"expecting
empty attachID, got %v"
,
attachID
)
}
}
}(
tc
.
spec
,
tc
.
attachID
,
tc
.
nodeName
,
tc
.
shouldFail
)
}(
tc
.
spec
,
tc
.
nodeName
,
tc
.
shouldFail
)
var
status
storage
.
VolumeAttachmentStatus
var
status
storage
.
VolumeAttachmentStatus
if
tc
.
injectAttacherError
{
if
tc
.
injectAttacherError
{
...
@@ -362,10 +362,7 @@ func TestAttacherWithCSIDriver(t *testing.T) {
...
@@ -362,10 +362,7 @@ func TestAttacherWithCSIDriver(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Attach() failed: %s"
,
err
)
t
.
Errorf
(
"Attach() failed: %s"
,
err
)
}
}
if
expectAttach
&&
attachID
==
""
{
if
attachID
!=
""
{
t
.
Errorf
(
"Expected attachID, got nothing"
)
}
if
!
expectAttach
&&
attachID
!=
""
{
t
.
Errorf
(
"Expected empty attachID, got %q"
,
attachID
)
t
.
Errorf
(
"Expected empty attachID, got %q"
,
attachID
)
}
}
}(
spec
,
test
.
expectVolumeAttachment
)
}(
spec
,
test
.
expectVolumeAttachment
)
...
...
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