@@ -165,20 +165,29 @@ func (d *Driver) mountBlobfuseWithProxy(args, protocol string, authEnv []string)
165
165
defer cancel ()
166
166
klog .V (2 ).Infof ("start connecting to blobfuse proxy, protocol: %s, args: %s" , protocol , args )
167
167
conn , err := grpc .DialContext (ctx , d .blobfuseProxyEndpoint , grpc .WithInsecure (), grpc .WithBlock ())
168
- if err == nil {
169
- mountClient := NewMountClient (conn )
170
- mountreq := mount_azure_blob.MountAzureBlobRequest {
171
- MountArgs : args ,
172
- Protocol : protocol ,
173
- AuthEnv : authEnv ,
174
- }
175
- klog .V (2 ).Infof ("begin to mount with blobfuse proxy, protocol: %s, args: %s" , protocol , args )
176
- resp , err = mountClient .service .MountAzureBlob (context .TODO (), & mountreq )
177
- if err != nil {
178
- klog .Error ("GRPC call returned with an error:" , err )
168
+ if err != nil {
169
+ klog .Errorf ("failed to connect to blobfuse proxy: %v" , err )
170
+ return "" , err
171
+ }
172
+ defer func () {
173
+ if err := conn .Close (); err != nil {
174
+ klog .Errorf ("failed to close connection to blobfuse proxy: %v" , err )
179
175
}
180
- output = resp .GetOutput ()
176
+ }()
177
+
178
+ mountClient := NewMountClient (conn )
179
+ mountreq := mount_azure_blob.MountAzureBlobRequest {
180
+ MountArgs : args ,
181
+ Protocol : protocol ,
182
+ AuthEnv : authEnv ,
183
+ }
184
+ klog .V (2 ).Infof ("begin to mount with blobfuse proxy, protocol: %s, args: %s" , protocol , args )
185
+ resp , err = mountClient .service .MountAzureBlob (context .TODO (), & mountreq )
186
+ if err != nil {
187
+ klog .Error ("GRPC call returned with an error:" , err )
181
188
}
189
+ output = resp .GetOutput ()
190
+
182
191
return output , err
183
192
}
184
193
0 commit comments