@@ -228,9 +228,13 @@ func handle() {
228
228
if err != nil {
229
229
klog .Fatalf ("Failed to set up metadata service: %v" , err .Error ())
230
230
}
231
+ isDataCacheEnabledNodePool , err := isDataCacheEnabledNodePool (ctx , * nodeName )
232
+ if err != nil {
233
+ klog .Fatalf ("Failed to get node info from API server: %v" , err .Error ())
234
+ }
231
235
nsArgs := driver.NodeServerArgs {
232
236
EnableDataCache : * enableDataCacheFlag ,
233
- DataCacheEnabledNodePool : isDataCacheEnabledNodePool ( ctx , * nodeName ) ,
237
+ DataCacheEnabledNodePool : isDataCacheEnabledNodePool ,
234
238
}
235
239
nodeServer = driver .NewNodeServer (gceDriver , mounter , deviceUtils , meta , statter , nsArgs )
236
240
if * maxConcurrentFormatAndMount > 0 {
@@ -328,14 +332,17 @@ func urlFlag(target **url.URL, name string, usage string) {
328
332
})
329
333
}
330
334
331
- func isDataCacheEnabledNodePool (ctx context.Context , nodeName string ) bool {
335
+ func isDataCacheEnabledNodePool (ctx context.Context , nodeName string ) (bool , error ) {
336
+ if ! * enableDataCacheFlag {
337
+ return false , nil
338
+ }
332
339
if nodeName != common .TestNode { // disregard logic below when E2E testing.
333
340
dataCacheLSSDCount , err := driver .GetDataCacheCountFromNodeLabel (ctx , nodeName )
334
- if err != nil || dataCacheLSSDCount == 0 {
335
- return false
336
- }
341
+ return dataCacheLSSDCount != 0 , err
342
+ } else if nodeName == common . TestNode {
343
+ return true , nil
337
344
}
338
- return true
345
+ return false , nil
339
346
}
340
347
341
348
func fetchLssdsForRaiding (lssdCount int ) ([]string , error ) {
0 commit comments