You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/gce-pd-csi-driver/main.go
+8-1
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,9 @@ var (
64
64
waitForOpBackoffSteps=flag.Int("wait-op-backoff-steps", 100, "Steps for wait for operation backoff")
65
65
waitForOpBackoffCap=flag.Duration("wait-op-backoff-cap", 0, "Cap for wait for operation backoff")
66
66
67
+
enableDeviceInUseCheck=flag.Bool("enable-device-in-use-check-on-node-unstage", true, "If set to true, block NodeUnstageVolume requests until the specified device is not in use")
68
+
deviceInUseTimeout=flag.Duration("device-in-use-timeout", 30*time.Second, "Max time to wait for a device to be unused when attempting to unstage. Exceeding the timeout will cause an unstage request to return success and ignore the device in use check.")
maxConcurrentFormat=flag.Int("max-concurrent-format", 1, "The maximum number of concurrent format exec calls")
69
72
concurrentFormatTimeout=flag.Duration("concurrent-format-timeout", 1*time.Minute, "The maximum duration of a format operation before its concurrency token is released")
@@ -241,7 +244,11 @@ func handle() {
241
244
iferr!=nil {
242
245
klog.Fatalf("Failed to set up metadata service: %v", err.Error())
klog.Warningf("Unabled to check if device for %s is unused. Device has been unmounted successfully. Ignoring and continuing with unstaging. (%v)", volumeID, err)
462
-
} else {
463
-
returnnil, status.Errorf(codes.Internal, "NodeUnstageVolume for volume %s failed: %v", volumeID, err)
klog.Warningf("Unable to check if device for %s is unused. Device has been unmounted successfully. Ignoring and continuing with unstaging. (%v)", volumeID, err)
klog.Warningf("Device %s could not be released after timeout of %f seconds. NodeUnstageVolume will return success.", volumeID, ns.deviceInUseErrors.timeout.Seconds())
481
+
} else {
482
+
ns.deviceInUseErrors.markDeviceError(volumeID)
483
+
returnnil, status.Errorf(codes.Internal, "NodeUnstageVolume for volume %s failed: %v", volumeID, err)
484
+
}
464
485
}
486
+
ns.deviceInUseErrors.deleteDevice(volumeID)
465
487
}
466
488
467
489
klog.V(4).Infof("NodeUnstageVolume succeeded on %v from %s", volumeID, stagingTargetPath)
0 commit comments