@@ -349,24 +349,14 @@ func fetchLssdsForRaiding(lssdCount int) ([]string, error) {
349
349
return nil , fmt .Errorf ("Error listing RAIDed LSSDs %v" , err )
350
350
}
351
351
352
- unRaidedLssds := []string {}
353
- for _ , l := range allLssds {
354
- if ! slices .Contains (raidedLssds , l ) {
355
- unRaidedLssds = append (unRaidedLssds , l )
356
- }
357
- if len (unRaidedLssds ) == lssdCount {
358
- break
359
- }
360
- }
361
-
362
352
LSSDsWithEmptyMountPoint , err := driver .FetchLSSDsWihtEmptyMountPoint ()
363
353
if err != nil {
364
354
return nil , fmt .Errorf ("Error listing LSSDs with empty mountpoint: %v" , err )
365
355
}
366
356
367
357
// We need to ensure the disks to be used for Data Cache are both unRAIDed & not containing mountpoints for ephemeral storage already
368
- availableLssds := slices .Filter (nil , unRaidedLssds , func (e string ) bool {
369
- return slices .Contains (LSSDsWithEmptyMountPoint , e )
358
+ availableLssds := slices .Filter (nil , allLssds , func (e string ) bool {
359
+ return slices .Contains (LSSDsWithEmptyMountPoint , e ) && ! slices . Contains ( raidedLssds , e )
370
360
})
371
361
372
362
if len (availableLssds ) == 0 {
@@ -376,7 +366,8 @@ func fetchLssdsForRaiding(lssdCount int) ([]string, error) {
376
366
if len (availableLssds ) < lssdCount {
377
367
return nil , fmt .Errorf ("Not enough LSSDs available to set up caching. Available LSSDs: %v, wanted LSSDs: %v" , len (availableLssds ), lssdCount )
378
368
}
379
- return availableLssds , nil
369
+
370
+ return availableLssds [:lssdCount ], nil
380
371
}
381
372
382
373
func setupDataCache (ctx context.Context , nodeName string ) error {
0 commit comments