@@ -10,21 +10,21 @@ import (
10
10
"k8s.io/klog/v2"
11
11
)
12
12
13
- type Smb struct {
13
+ type SMB struct {
14
14
hostAPI smbapi.API
15
15
fs fs.Interface
16
16
}
17
17
18
18
type Interface interface {
19
- // NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share.
20
- NewSmbGlobalMapping (context.Context , * NewSmbGlobalMappingRequest ) (* NewSmbGlobalMappingResponse , error )
19
+ // NewSMBGlobalMapping creates an SMB mapping on the SMB client to an SMB share.
20
+ NewSMBGlobalMapping (context.Context , * NewSMBGlobalMappingRequest ) (* NewSMBGlobalMappingResponse , error )
21
21
22
- // RemoveSmbGlobalMapping removes the SMB mapping to an SMB share.
23
- RemoveSmbGlobalMapping (context.Context , * RemoveSmbGlobalMappingRequest ) (* RemoveSmbGlobalMappingResponse , error )
22
+ // RemoveSMBGlobalMapping removes the SMB mapping to an SMB share.
23
+ RemoveSMBGlobalMapping (context.Context , * RemoveSMBGlobalMappingRequest ) (* RemoveSMBGlobalMappingResponse , error )
24
24
}
25
25
26
- // check that Smb implements the Interface
27
- var _ Interface = & Smb {}
26
+ // check that SMB implements the Interface
27
+ var _ Interface = & SMB {}
28
28
29
29
func normalizeWindowsPath (path string ) string {
30
30
normalizedPath := strings .Replace (path , "/" , "\\ " , - 1 )
@@ -46,21 +46,21 @@ func getRootMappingPath(path string) (string, error) {
46
46
klog .Errorf ("remote path (%s) is invalid" , path )
47
47
return "" , fmt .Errorf ("remote path (%s) is invalid" , path )
48
48
}
49
- // parts[0] is a smb host name
50
- // parts[1] is a smb share name
49
+ // parts[0] is a SMB host name
50
+ // parts[1] is a SMB share name
51
51
return strings .ToLower ("\\ \\ " + parts [0 ] + "\\ " + parts [1 ]), nil
52
52
}
53
53
54
- func New (hostAPI smbapi.API , fsClient fs.Interface ) (* Smb , error ) {
55
- return & Smb {
54
+ func New (hostAPI smbapi.API , fsClient fs.Interface ) (* SMB , error ) {
55
+ return & SMB {
56
56
hostAPI : hostAPI ,
57
57
fs : fsClient ,
58
58
}, nil
59
59
}
60
60
61
- func (s * Smb ) NewSmbGlobalMapping (context context.Context , request * NewSmbGlobalMappingRequest ) (* NewSmbGlobalMappingResponse , error ) {
62
- klog .V (2 ).Infof ("calling NewSmbGlobalMapping with remote path %q" , request .RemotePath )
63
- response := & NewSmbGlobalMappingResponse {}
61
+ func (s * SMB ) NewSMBGlobalMapping (context context.Context , request * NewSMBGlobalMappingRequest ) (* NewSMBGlobalMappingResponse , error ) {
62
+ klog .V (2 ).Infof ("calling NewSMBGlobalMapping with remote path %q" , request .RemotePath )
63
+ response := & NewSMBGlobalMappingResponse {}
64
64
remotePath := normalizeWindowsPath (request .RemotePath )
65
65
localPath := request .LocalPath
66
66
@@ -74,7 +74,7 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
74
74
return response , err
75
75
}
76
76
77
- isMapped , err := s .hostAPI .IsSmbMapped (mappingPath )
77
+ isMapped , err := s .hostAPI .IsSMBMapped (mappingPath )
78
78
if err != nil {
79
79
isMapped = false
80
80
}
@@ -89,9 +89,9 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
89
89
90
90
if ! validResp .Valid {
91
91
klog .V (4 ).Infof ("RemotePath %s is not valid, removing now" , mappingPath )
92
- err := s .hostAPI .RemoveSmbGlobalMapping (mappingPath )
92
+ err := s .hostAPI .RemoveSMBGlobalMapping (mappingPath )
93
93
if err != nil {
94
- klog .Errorf ("RemoveSmbGlobalMapping (%s) failed with %v" , mappingPath , err )
94
+ klog .Errorf ("RemoveSMBGlobalMapping (%s) failed with %v" , mappingPath , err )
95
95
return response , err
96
96
}
97
97
isMapped = false
@@ -102,9 +102,9 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
102
102
103
103
if ! isMapped {
104
104
klog .V (4 ).Infof ("Remote %s not mapped. Mapping now!" , mappingPath )
105
- err = s .hostAPI .NewSmbGlobalMapping (mappingPath , request .Username , request .Password )
105
+ err = s .hostAPI .NewSMBGlobalMapping (mappingPath , request .Username , request .Password )
106
106
if err != nil {
107
- klog .Errorf ("failed NewSmbGlobalMapping %v" , err )
107
+ klog .Errorf ("failed NewSMBGlobalMapping %v" , err )
108
108
return response , err
109
109
}
110
110
}
@@ -116,20 +116,20 @@ func (s *Smb) NewSmbGlobalMapping(context context.Context, request *NewSmbGlobal
116
116
klog .Errorf ("failed validate plugin path %v" , err )
117
117
return response , err
118
118
}
119
- err = s .hostAPI .NewSmbLink (remotePath , localPath )
119
+ err = s .hostAPI .NewSMBLink (remotePath , localPath )
120
120
if err != nil {
121
- klog .Errorf ("failed NewSmbLink %v" , err )
121
+ klog .Errorf ("failed NewSMBLink %v" , err )
122
122
return response , fmt .Errorf ("creating link %s to %s failed with error: %v" , localPath , remotePath , err )
123
123
}
124
124
}
125
125
126
- klog .V (2 ).Infof ("NewSmbGlobalMapping on remote path %q is completed" , request .RemotePath )
126
+ klog .V (2 ).Infof ("NewSMBGlobalMapping on remote path %q is completed" , request .RemotePath )
127
127
return response , nil
128
128
}
129
129
130
- func (s * Smb ) RemoveSmbGlobalMapping (context context.Context , request * RemoveSmbGlobalMappingRequest ) (* RemoveSmbGlobalMappingResponse , error ) {
131
- klog .V (2 ).Infof ("calling RemoveSmbGlobalMapping with remote path %q" , request .RemotePath )
132
- response := & RemoveSmbGlobalMappingResponse {}
130
+ func (s * SMB ) RemoveSMBGlobalMapping (context context.Context , request * RemoveSMBGlobalMappingRequest ) (* RemoveSMBGlobalMappingResponse , error ) {
131
+ klog .V (2 ).Infof ("calling RemoveSMBGlobalMapping with remote path %q" , request .RemotePath )
132
+ response := & RemoveSMBGlobalMappingResponse {}
133
133
remotePath := normalizeWindowsPath (request .RemotePath )
134
134
135
135
if remotePath == "" {
@@ -142,12 +142,12 @@ func (s *Smb) RemoveSmbGlobalMapping(context context.Context, request *RemoveSmb
142
142
return response , err
143
143
}
144
144
145
- err = s .hostAPI .RemoveSmbGlobalMapping (mappingPath )
145
+ err = s .hostAPI .RemoveSMBGlobalMapping (mappingPath )
146
146
if err != nil {
147
- klog .Errorf ("failed RemoveSmbGlobalMapping %v" , err )
147
+ klog .Errorf ("failed RemoveSMBGlobalMapping %v" , err )
148
148
return response , err
149
149
}
150
150
151
- klog .V (2 ).Infof ("RemoveSmbGlobalMapping on remote path %q is completed" , request .RemotePath )
151
+ klog .V (2 ).Infof ("RemoveSMBGlobalMapping on remote path %q is completed" , request .RemotePath )
152
152
return response , nil
153
153
}
0 commit comments