File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
staging/src/k8s.io/csi-translation-lib/plugins Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,19 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
87
87
}
88
88
89
89
gceSource := pv .Spec .PersistentVolumeSource .GCEPersistentDisk
90
+
91
+ partition := ""
92
+ if gceSource .Partition != 0 {
93
+ partition = strconv .Itoa (int (gceSource .Partition ))
94
+ }
95
+
90
96
csiSource := & v1.CSIPersistentVolumeSource {
91
97
Driver : GCEPDDriverName ,
92
98
VolumeHandle : volID ,
93
99
ReadOnly : gceSource .ReadOnly ,
94
100
FSType : gceSource .FSType ,
95
101
VolumeAttributes : map [string ]string {
96
- "partition" : strconv . FormatInt ( int64 ( gceSource . Partition ), 10 ) ,
102
+ "partition" : partition ,
97
103
},
98
104
}
99
105
@@ -121,7 +127,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateCSIPVToInTree(pv *v1.Persisten
121
127
FSType : csiSource .FSType ,
122
128
ReadOnly : csiSource .ReadOnly ,
123
129
}
124
- if partition , ok := csiSource .VolumeAttributes ["partition" ]; ok {
130
+ if partition , ok := csiSource .VolumeAttributes ["partition" ]; ok && partition != "" {
125
131
partInt , err := strconv .Atoi (partition )
126
132
if err != nil {
127
133
return nil , fmt .Errorf ("Failed to convert partition %v to integer: %v" , partition , err )
You can’t perform that action at this time.
0 commit comments