mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-24 14:00:19 +00:00
rbd: Backout if image features is empty
In golang world, if you split an empty string that does not contain
the seperator, you get an array with one empty string. This results
in volumes failing to mount with "invalid feature " (note extra space
because it's trying to check if 'empty string' is a valid feature).
This patch checks if the string is empty, and if so, it just decides
to skip the entire validation and returning nothing.
Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
(cherry picked from commit 671d6a7767
)
This commit is contained in:
parent
f476a376f7
commit
6b86391bb2
@ -993,6 +993,13 @@ func genVolFromVolumeOptions(ctx context.Context, volOptions, credentials map[st
|
||||
}
|
||||
|
||||
func (rv *rbdVolume) validateImageFeatures(imageFeatures string) error {
|
||||
// It is possible for image features to be an empty string which
|
||||
// the Go split function would return a single item array with
|
||||
// an empty string, causing a failure when trying to validate
|
||||
// the features.
|
||||
if strings.TrimSpace(imageFeatures) == "" {
|
||||
return nil
|
||||
}
|
||||
arr := strings.Split(imageFeatures, ",")
|
||||
featureSet := sets.NewString(arr...)
|
||||
for _, f := range arr {
|
||||
|
Loading…
Reference in New Issue
Block a user