@@ -94,9 +94,7 @@ func doMount(mounter mountutils.Interface, opt *Options, targetPath, volumeId, p
9494 }
9595 mountFstype = "alinas"
9696 // err = mounter.Mount(source, mountPoint, "alinas", combinedOptions)
97- isPathNotFound = func (err error ) bool {
98- return strings .Contains (err .Error (), "Failed to bind mount" )
99- }
97+ isPathNotFound = isEFCPathNotFoundError
10098 case NativeClient :
10199 switch opt .FSType {
102100 case "cpfs" :
@@ -115,17 +113,16 @@ func doMount(mounter mountutils.Interface, opt *Options, targetPath, volumeId, p
115113 // must enable tls when using accesspoint
116114 combinedOptions = addTLSMountOptions (combinedOptions )
117115 }
116+ isPathNotFound = isNFSPathNotFoundError
118117 // Enable compatibility for BMCPFS VPC mount points using the NAS Driver, to support the same usage in ECI.
119118 if isCPFS (opt .FSType , opt .Server ) && opt .MountProtocol == "efc" {
120119 mountFstype = "alinas"
121120 combinedOptions = append (combinedOptions , "efc,protocol=efc,net=tcp,fstype=cpfs" )
121+ isPathNotFound = isEFCPathNotFoundError
122122 }
123123 if mountFstype == "" {
124124 mountFstype = opt .MountProtocol
125125 }
126- isPathNotFound = func (err error ) bool {
127- return strings .Contains (err .Error (), "reason given by server: No such file or directory" ) || strings .Contains (err .Error (), "access denied by server while mounting" )
128- }
129126 }
130127 err := mounter .Mount (source , targetPath , mountFstype , combinedOptions )
131128 if err == nil {
@@ -166,6 +163,23 @@ func doMount(mounter mountutils.Interface, opt *Options, targetPath, volumeId, p
166163 return mounter .Mount (source , targetPath , mountFstype , combinedOptions )
167164}
168165
166+ func isEFCPathNotFoundError (err error ) bool {
167+ return strings .Contains (err .Error (), "Failed to bind mount" )
168+ }
169+
170+ func isNFSPathNotFoundError (err error ) bool {
171+ errors := []string {
172+ "reason given by server: No such file or directory" ,
173+ "access denied by server while mounting" ,
174+ }
175+ for _ , error := range errors {
176+ if strings .Contains (err .Error (), error ) {
177+ return true
178+ }
179+ }
180+ return false
181+ }
182+
169183// check system config,
170184// if tcp_slot_table_entries not set to 128, just config.
171185func checkSystemNasConfig () error {
0 commit comments