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
e59f261c
Commit
e59f261c
authored
Mar 04, 2019
by
David Zhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix partition for 0 partitions defaulting
parent
feb0937f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
gce_pd.go
staging/src/k8s.io/csi-translation-lib/plugins/gce_pd.go
+8
-2
No files found.
staging/src/k8s.io/csi-translation-lib/plugins/gce_pd.go
View file @
e59f261c
...
@@ -87,13 +87,19 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
...
@@ -87,13 +87,19 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
}
}
gceSource
:=
pv
.
Spec
.
PersistentVolumeSource
.
GCEPersistentDisk
gceSource
:=
pv
.
Spec
.
PersistentVolumeSource
.
GCEPersistentDisk
partition
:=
""
if
gceSource
.
Partition
!=
0
{
partition
=
strconv
.
Itoa
(
int
(
gceSource
.
Partition
))
}
csiSource
:=
&
v1
.
CSIPersistentVolumeSource
{
csiSource
:=
&
v1
.
CSIPersistentVolumeSource
{
Driver
:
GCEPDDriverName
,
Driver
:
GCEPDDriverName
,
VolumeHandle
:
volID
,
VolumeHandle
:
volID
,
ReadOnly
:
gceSource
.
ReadOnly
,
ReadOnly
:
gceSource
.
ReadOnly
,
FSType
:
gceSource
.
FSType
,
FSType
:
gceSource
.
FSType
,
VolumeAttributes
:
map
[
string
]
string
{
VolumeAttributes
:
map
[
string
]
string
{
"partition"
:
strconv
.
FormatInt
(
int64
(
gceSource
.
Partition
),
10
)
,
"partition"
:
partition
,
},
},
}
}
...
@@ -121,7 +127,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.Persisten
...
@@ -121,7 +127,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.Persisten
FSType
:
csiSource
.
FSType
,
FSType
:
csiSource
.
FSType
,
ReadOnly
:
csiSource
.
ReadOnly
,
ReadOnly
:
csiSource
.
ReadOnly
,
}
}
if
partition
,
ok
:=
csiSource
.
VolumeAttributes
[
"partition"
];
ok
{
if
partition
,
ok
:=
csiSource
.
VolumeAttributes
[
"partition"
];
ok
&&
partition
!=
""
{
partInt
,
err
:=
strconv
.
Atoi
(
partition
)
partInt
,
err
:=
strconv
.
Atoi
(
partition
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to convert partition %v to integer: %v"
,
partition
,
err
)
return
nil
,
fmt
.
Errorf
(
"Failed to convert partition %v to integer: %v"
,
partition
,
err
)
...
...
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