Skip to content

Commit 6ea8340

Browse files
committed
Only run data cache watcher if a data cache nodepool exist & adding
check for VG cleanup
1 parent 8ff8d2a commit 6ea8340

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cmd/gce-pd-csi-driver/main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ func handle() {
262262
if err := setupDataCache(ctx, *nodeName, nodeServer.MetadataService.GetName()); err != nil {
263263
klog.Errorf("DataCache setup failed: %v", err)
264264
}
265-
go driver.StartWatcher(*nodeName)
265+
if nsArgs.DataCacheEnabledNodePool {
266+
go driver.StartWatcher(*nodeName)
267+
}
266268
}
267269
}
268270

pkg/gce-pd-csi-driver/cache.go

+3
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ func createVg(volumeGroupName string, raidedLocalSsds string) error {
453453
}
454454

455455
func reduceVolumeGroup(volumeGroupName string, force bool) {
456+
if !checkVgExists(volumeGroupName) {
457+
return
458+
}
456459
args := []string{
457460
"--removemissing",
458461
volumeGroupName,

0 commit comments

Comments
 (0)