59
59
waitForOpBackoffSteps = flag .Int ("wait-op-backoff-steps" , 100 , "Steps for wait for operation backoff" )
60
60
waitForOpBackoffCap = flag .Duration ("wait-op-backoff-cap" , 0 , "Cap for wait for operation backoff" )
61
61
62
- maxprocs = flag .Int ("maxprocs" , 1 , "GOMAXPROCS override" )
62
+ maxProcs = flag .Int ("maxprocs" , 1 , "GOMAXPROCS override" )
63
+ maxConcurrentFormat = flag .Int ("max-concurrent-format" , 1 , "The maximum number of concurrent format exec calls" )
64
+ concurrentFormatTimeout = flag .Duration ("concurrent-format-timeout" , 1 * time .Minute , "The maximum duration of a format operation before its concurrency token is released" )
63
65
64
66
version string
65
67
)
@@ -88,7 +90,7 @@ func main() {
88
90
func handle () {
89
91
var err error
90
92
91
- runtime .GOMAXPROCS (* maxprocs )
93
+ runtime .GOMAXPROCS (* maxProcs )
92
94
klog .Infof ("Sys info: NumCPU: %v MAXPROC: %v" , runtime .NumCPU (), runtime .GOMAXPROCS (0 ))
93
95
94
96
if version == "" {
@@ -110,16 +112,16 @@ func handle() {
110
112
klog .Fatalf ("Bad extra volume labels: %v" , err .Error ())
111
113
}
112
114
113
- gceDriver := driver .GetGCEDriver ()
114
-
115
- //Initialize GCE Driver
116
115
ctx , cancel := context .WithCancel (context .Background ())
117
116
defer cancel ()
118
117
119
- //Initialize identity server
118
+ // Initialize driver
119
+ gceDriver := driver .GetGCEDriver ()
120
+
121
+ // Initialize identity server
120
122
identityServer := driver .NewIdentityServer (gceDriver )
121
123
122
- //Initialize requirements for the controller service
124
+ // Initialize requirements for the controller service
123
125
var controllerServer * driver.GCEControllerServer
124
126
if * runControllerService {
125
127
cloudProvider , err := gce .CreateCloudProvider (ctx , version , * cloudConfigFilePath , * computeEndpoint )
@@ -133,13 +135,10 @@ func handle() {
133
135
klog .Warningf ("controller service is disabled but cloud config given - it has no effect" )
134
136
}
135
137
136
- //Initialize requirements for the node service
138
+ // Initialize requirements for the node service
137
139
var nodeServer * driver.GCENodeServer
138
140
if * runNodeService {
139
- mounter , err := mountmanager .NewSafeMounter ()
140
- if err != nil {
141
- klog .Fatalf ("Failed to get safe mounter: %v" , err .Error ())
142
- }
141
+ mounter := mountmanager .NewSafeMounter (* maxConcurrentFormat , * concurrentFormatTimeout )
143
142
deviceUtils := deviceutils .NewDeviceUtils ()
144
143
statter := mountmanager .NewStatter (mounter )
145
144
meta , err := metadataservice .NewMetadataService ()
0 commit comments