@@ -368,24 +368,14 @@ func fetchLssdsForRaiding(lssdCount int) ([]string, error) {
368
368
return nil , fmt .Errorf ("Error listing RAIDed LSSDs %v" , err )
369
369
}
370
370
371
- unRaidedLssds := []string {}
372
- for _ , l := range allLssds {
373
- if ! slices .Contains (raidedLssds , l ) {
374
- unRaidedLssds = append (unRaidedLssds , l )
375
- }
376
- if len (unRaidedLssds ) == lssdCount {
377
- break
378
- }
379
- }
380
-
381
371
LSSDsWithEmptyMountPoint , err := driver .FetchLSSDsWihtEmptyMountPoint ()
382
372
if err != nil {
383
373
return nil , fmt .Errorf ("Error listing LSSDs with empty mountpoint: %v" , err )
384
374
}
385
375
386
376
// We need to ensure the disks to be used for Data Cache are both unRAIDed & not containing mountpoints for ephemeral storage already
387
- availableLssds := slices .Filter (nil , unRaidedLssds , func (e string ) bool {
388
- return slices .Contains (LSSDsWithEmptyMountPoint , e )
377
+ availableLssds := slices .Filter (nil , allLssds , func (e string ) bool {
378
+ return slices .Contains (LSSDsWithEmptyMountPoint , e ) && ! slices . Contains ( raidedLssds , e )
389
379
})
390
380
391
381
if len (availableLssds ) == 0 {
@@ -395,7 +385,8 @@ func fetchLssdsForRaiding(lssdCount int) ([]string, error) {
395
385
if len (availableLssds ) < lssdCount {
396
386
return nil , fmt .Errorf ("Not enough LSSDs available to set up caching. Available LSSDs: %v, wanted LSSDs: %v" , len (availableLssds ), lssdCount )
397
387
}
398
- return availableLssds , nil
388
+
389
+ return availableLssds [:lssdCount ], nil
399
390
}
400
391
401
392
func setupDataCache (ctx context.Context , nodeName string , nodeId string ) error {
0 commit comments