Skip to content

Commit 088819c

Browse files
committed
fix empty volume group creation through cli tool
when creating empty volume group through cli, the strings.Split() function returns a [""] value, i.e, a slice of lenght 1 having the value as 1 "" empty string as a result the csi results in panic when it tries to find the volumeID with the respective value. Signed-off-by: Nikhil-Ladha <[email protected]>
1 parent 509ea1a commit 088819c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd/csi-addons/volumegroup.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ func (vgb *VolumeGroupBase) SetParameters(parameters string) error {
7575
return nil
7676
}
7777

78-
// SetVolumeIDs sets and parses the volume IDs
78+
// SetVolumeIDs sets and parses the volume IDs, only if volumeids are provided.
7979
func (vgb *VolumeGroupBase) SetVolumeIDs(volumeids string) {
80-
volumeIDs := strings.Split(volumeids, ",")
81-
vgb.volumeIDs = volumeIDs
80+
if volumeids != "" {
81+
volumeIDs := strings.Split(volumeids, ",")
82+
vgb.volumeIDs = volumeIDs
83+
}
8284
}
8385

8486
// Parses the parameters to convert them from string format to map[string]string format

0 commit comments

Comments
 (0)