Skip to content

[release-1.17] Adding additional checks for data cache watcher and reduceVolumeGroup #1969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cmd/gce-pd-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ func handle() {
if nodeName == nil || *nodeName == "" {
klog.Errorf("Data Cache enabled, but --node-name not passed")
}
if err := setupDataCache(ctx, *nodeName, nodeServer.MetadataService.GetName()); err != nil {
klog.Errorf("DataCache setup failed: %v", err)
if nsArgs.DataCacheEnabledNodePool {
if err := setupDataCache(ctx, *nodeName, nodeServer.MetadataService.GetName()); err != nil {
klog.Errorf("Data Cache setup failed: %v", err)
}
go driver.StartWatcher(*nodeName)
}
go driver.StartWatcher(*nodeName)
}
}

Expand Down Expand Up @@ -346,9 +348,11 @@ func urlFlag(target **url.URL, name string, usage string) {
}

func isDataCacheEnabledNodePool(ctx context.Context, nodeName string) bool {
dataCacheLSSDCount, err := driver.GetDataCacheCountFromNodeLabel(ctx, nodeName)
if err != nil || dataCacheLSSDCount == 0 {
return false
if nodeName != common.TestNode { // disregard logic below when E2E testing.
dataCacheLSSDCount, err := driver.GetDataCacheCountFromNodeLabel(ctx, nodeName)
if err != nil || dataCacheLSSDCount == 0 {
return false
}
}
return true
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/gce-pd-csi-driver/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ func createVg(volumeGroupName string, raidedLocalSsds string) error {
}

func reduceVolumeGroup(volumeGroupName string, force bool) {
if !checkVgExists(volumeGroupName) {
klog.V(2).Infof("Volume group %v not found, no further action needed", volumeGroupName)
return
}
args := []string{
"--removemissing",
volumeGroupName,
Expand Down