@@ -108,18 +108,18 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
108
108
if createSubDir {
109
109
// Mount smb base share so we can create a subdirectory
110
110
if err := d .internalMount (ctx , smbVol , volCap , secrets ); err != nil {
111
- return nil , status .Errorf (codes .Internal , "failed to mount smb server: %v" , err . Error () )
111
+ return nil , status .Errorf (codes .Internal , "failed to mount smb server: %v" , err )
112
112
}
113
113
defer func () {
114
114
if err = d .internalUnmount (ctx , smbVol ); err != nil {
115
- klog .Warningf ("failed to unmount smb server: %v" , err . Error () )
115
+ klog .Warningf ("failed to unmount smb server: %v" , err )
116
116
}
117
117
}()
118
118
// Create subdirectory under base-dir
119
119
// TODO: revisit permissions
120
120
internalVolumePath := getInternalVolumePath (d .workingMountDir , smbVol )
121
121
if err = os .MkdirAll (internalVolumePath , 0777 ); err != nil {
122
- return nil , status .Errorf (codes .Internal , "failed to make subdirectory: %v" , err . Error () )
122
+ return nil , status .Errorf (codes .Internal , "failed to make subdirectory: %v" , err )
123
123
}
124
124
125
125
if req .GetVolumeContentSource () != nil {
@@ -182,7 +182,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
182
182
// check whether volumeID is in the cache
183
183
cache , err := d .volDeletionCache .Get (volumeID , azcache .CacheReadTypeDefault )
184
184
if err != nil {
185
- return nil , status .Errorf (codes .Internal , err . Error () )
185
+ return nil , status .Errorf (codes .Internal , "%v" , err )
186
186
}
187
187
if cache != nil {
188
188
klog .V (2 ).Infof ("DeleteVolume: volume %s is already deleted" , volumeID )
@@ -191,11 +191,11 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
191
191
192
192
// mount smb base share so we can delete or archive the subdirectory
193
193
if err = d .internalMount (ctx , smbVol , volCap , secrets ); err != nil {
194
- return nil , status .Errorf (codes .Internal , "failed to mount smb server: %v" , err . Error () )
194
+ return nil , status .Errorf (codes .Internal , "failed to mount smb server: %v" , err )
195
195
}
196
196
defer func () {
197
197
if err = d .internalUnmount (ctx , smbVol ); err != nil {
198
- klog .Warningf ("failed to unmount smb server: %v" , err . Error () )
198
+ klog .Warningf ("failed to unmount smb server: %v" , err )
199
199
}
200
200
}()
201
201
@@ -207,7 +207,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
207
207
parentDir := filepath .Dir (archivedInternalVolumePath )
208
208
klog .V (2 ).Infof ("DeleteVolume: subdirectory(%s) contains '/', make sure the parent directory(%s) exists" , smbVol .subDir , parentDir )
209
209
if err = os .MkdirAll (parentDir , 0777 ); err != nil {
210
- return nil , status .Errorf (codes .Internal , "create parent directory(%s) of %s failed with %v" , parentDir , archivedInternalVolumePath , err . Error () )
210
+ return nil , status .Errorf (codes .Internal , "create parent directory(%s) of %s failed with %v" , parentDir , archivedInternalVolumePath , err )
211
211
}
212
212
}
213
213
@@ -216,16 +216,16 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
216
216
if d .removeArchivedVolumePath {
217
217
klog .V (2 ).Infof ("removing archived subdirectory at %v" , archivedInternalVolumePath )
218
218
if err = os .RemoveAll (archivedInternalVolumePath ); err != nil {
219
- return nil , status .Errorf (codes .Internal , "failed to delete archived subdirectory %s: %v" , archivedInternalVolumePath , err . Error () )
219
+ return nil , status .Errorf (codes .Internal , "failed to delete archived subdirectory %s: %v" , archivedInternalVolumePath , err )
220
220
}
221
221
klog .V (2 ).Infof ("removed archived subdirectory at %v" , archivedInternalVolumePath )
222
222
}
223
223
if err = os .Rename (internalVolumePath , archivedInternalVolumePath ); err != nil {
224
- return nil , status .Errorf (codes .Internal , "archive subdirectory(%s, %s) failed with %v" , internalVolumePath , archivedInternalVolumePath , err . Error () )
224
+ return nil , status .Errorf (codes .Internal , "archive subdirectory(%s, %s) failed with %v" , internalVolumePath , archivedInternalVolumePath , err )
225
225
}
226
226
} else {
227
227
if _ , err2 := os .Lstat (internalVolumePath ); err2 == nil {
228
- err2 := filepath .WalkDir (internalVolumePath , func (path string , di fs.DirEntry , err error ) error {
228
+ err2 := filepath .WalkDir (internalVolumePath , func (path string , _ fs.DirEntry , _ error ) error {
229
229
return os .Chmod (path , 0777 )
230
230
})
231
231
if err2 != nil {
@@ -234,7 +234,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
234
234
}
235
235
klog .V (2 ).Infof ("Removing subdirectory at %v" , internalVolumePath )
236
236
if err = os .RemoveAll (internalVolumePath ); err != nil {
237
- return nil , status .Errorf (codes .Internal , "failed to delete subdirectory: %v" , err . Error () )
237
+ return nil , status .Errorf (codes .Internal , "failed to delete subdirectory: %v" , err )
238
238
}
239
239
}
240
240
} else {
0 commit comments