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
0df13e7d
Commit
0df13e7d
authored
Jun 26, 2018
by
wenlxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add volume mode field to constructed VolumeSpec
parent
28b7809d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
csi_plugin.go
pkg/volume/csi/csi_plugin.go
+2
-0
csi_plugin_test.go
pkg/volume/csi/csi_plugin_test.go
+16
-0
No files found.
pkg/volume/csi/csi_plugin.go
View file @
0df13e7d
...
...
@@ -248,6 +248,7 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
glog
.
V
(
4
)
.
Info
(
log
(
"plugin.ConstructVolumeSpec extracted [%#v]"
,
volData
))
fsMode
:=
api
.
PersistentVolumeFilesystem
pv
:=
&
api
.
PersistentVolume
{
ObjectMeta
:
meta
.
ObjectMeta
{
Name
:
volData
[
volDataKey
.
specVolID
],
...
...
@@ -259,6 +260,7 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
VolumeHandle
:
volData
[
volDataKey
.
volHandle
],
},
},
VolumeMode
:
&
fsMode
,
},
}
...
...
pkg/volume/csi/csi_plugin_test.go
View file @
0df13e7d
...
...
@@ -186,6 +186,14 @@ func TestPluginConstructVolumeSpec(t *testing.T) {
t
.
Errorf
(
"expected volID %s, got volID %s"
,
tc
.
data
[
volDataKey
.
volHandle
],
volHandle
)
}
if
spec
.
PersistentVolume
.
Spec
.
VolumeMode
==
nil
{
t
.
Fatalf
(
"Volume mode has not been set."
)
}
if
*
spec
.
PersistentVolume
.
Spec
.
VolumeMode
!=
api
.
PersistentVolumeFilesystem
{
t
.
Errorf
(
"Unexpected volume mode %q"
,
*
spec
.
PersistentVolume
.
Spec
.
VolumeMode
)
}
if
spec
.
Name
()
!=
tc
.
specVolID
{
t
.
Errorf
(
"Unexpected spec name %s"
,
spec
.
Name
())
}
...
...
@@ -463,6 +471,14 @@ func TestPluginConstructBlockVolumeSpec(t *testing.T) {
continue
}
if
spec
.
PersistentVolume
.
Spec
.
VolumeMode
==
nil
{
t
.
Fatalf
(
"Volume mode has not been set."
)
}
if
*
spec
.
PersistentVolume
.
Spec
.
VolumeMode
!=
api
.
PersistentVolumeBlock
{
t
.
Errorf
(
"Unexpected volume mode %q"
,
*
spec
.
PersistentVolume
.
Spec
.
VolumeMode
)
}
volHandle
:=
spec
.
PersistentVolume
.
Spec
.
CSI
.
VolumeHandle
if
volHandle
!=
tc
.
data
[
volDataKey
.
volHandle
]
{
t
.
Errorf
(
"expected volID %s, got volID %s"
,
tc
.
data
[
volDataKey
.
volHandle
],
volHandle
)
...
...
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