@@ -108,18 +108,18 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
108108 if createSubDir {
109109 // Mount smb base share so we can create a subdirectory
110110 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 )
112112 }
113113 defer func () {
114114 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 )
116116 }
117117 }()
118118 // Create subdirectory under base-dir
119119 // TODO: revisit permissions
120120 internalVolumePath := getInternalVolumePath (d .workingMountDir , smbVol )
121121 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 )
123123 }
124124
125125 if req .GetVolumeContentSource () != nil {
@@ -182,7 +182,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
182182 // check whether volumeID is in the cache
183183 cache , err := d .volDeletionCache .Get (volumeID , azcache .CacheReadTypeDefault )
184184 if err != nil {
185- return nil , status .Errorf (codes .Internal , err . Error () )
185+ return nil , status .Errorf (codes .Internal , "%v" , err )
186186 }
187187 if cache != nil {
188188 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)
191191
192192 // mount smb base share so we can delete or archive the subdirectory
193193 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 )
195195 }
196196 defer func () {
197197 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 )
199199 }
200200 }()
201201
@@ -207,7 +207,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
207207 parentDir := filepath .Dir (archivedInternalVolumePath )
208208 klog .V (2 ).Infof ("DeleteVolume: subdirectory(%s) contains '/', make sure the parent directory(%s) exists" , smbVol .subDir , parentDir )
209209 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 )
211211 }
212212 }
213213
@@ -216,16 +216,16 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
216216 if d .removeArchivedVolumePath {
217217 klog .V (2 ).Infof ("removing archived subdirectory at %v" , archivedInternalVolumePath )
218218 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 )
220220 }
221221 klog .V (2 ).Infof ("removed archived subdirectory at %v" , archivedInternalVolumePath )
222222 }
223223 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 )
225225 }
226226 } else {
227227 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 {
229229 return os .Chmod (path , 0777 )
230230 })
231231 if err2 != nil {
@@ -234,7 +234,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
234234 }
235235 klog .V (2 ).Infof ("Removing subdirectory at %v" , internalVolumePath )
236236 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 )
238238 }
239239 }
240240 } else {
0 commit comments