@@ -217,12 +217,12 @@ func mountPoint2ContainerName(mountPoint string) string {
217
217
return fmt .Sprintf ("curvefs-filesystem-%s" , utils .MD5Sum (mountPoint ))
218
218
}
219
219
220
- func checkMountStatus (mountPoint string , out * string ) step.LambdaType {
220
+ func checkMountStatus (mountPoint , name string , out * string ) step.LambdaType {
221
221
return func (ctx * context.Context ) error {
222
- if len ( * out ) == 0 {
223
- return nil
222
+ if * out == name {
223
+ return errno . ERR_FS_PATH_ALREADY_MOUNTED . F ( "mountPath: %s" , mountPoint )
224
224
}
225
- return errno . ERR_FS_PATH_ALREADY_MOUNTED . F ( "mountPath: %s" , mountPoint )
225
+ return nil
226
226
}
227
227
}
228
228
@@ -305,14 +305,13 @@ func NewMountFSTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig) (*task.T
305
305
})
306
306
t .AddStep (& step.ListContainers {
307
307
ShowAll : true ,
308
- Format : "'{{.Status}}'" ,
309
- Quiet : true ,
308
+ Format : "'{{.Names}}'" ,
310
309
Filter : fmt .Sprintf ("name=%s" , containerName ),
311
310
Out : & out ,
312
311
ExecOptions : curveadm .ExecOptions (),
313
312
})
314
313
t .AddStep (& step.Lambda {
315
- Lambda : checkMountStatus (mountPoint , & out ),
314
+ Lambda : checkMountStatus (mountPoint , containerName , & out ),
316
315
})
317
316
t .AddStep (& step.PullImage {
318
317
Image : cc .GetContainerImage (),
0 commit comments