Skip to content

Commit 9d83a9c

Browse files
zztakicaoxianfei1
authored andcommitted
Fix (target start): curveadm target start timeout
Signed-off-by: zztaki <[email protected]>
1 parent 580b26d commit 9d83a9c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

internal/task/step/container.go

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ type (
119119
ContainerExec struct {
120120
ContainerId *string
121121
Command string
122+
Detached bool
122123
Success *bool
123124
Out *string
124125
module.ExecOptions
@@ -289,6 +290,9 @@ func (s *ListContainers) Execute(ctx *context.Context) error {
289290

290291
func (s *ContainerExec) Execute(ctx *context.Context) error {
291292
cli := ctx.Module().DockerCli().ContainerExec(*s.ContainerId, s.Command)
293+
if s.Detached {
294+
cli.AddOption("--detach")
295+
}
292296
out, err := cli.Execute(s.ExecOptions)
293297
return PostHandle(s.Success, s.Out, out, err, errno.ERR_RUN_COMMAND_IN_CONTAINER_FAILED.FD("(%s exec CONTAINER COMMAND)", s.ExecWithEngine))
294298
}

internal/task/task/bs/start_tgtd.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig
127127
ExecOptions: curveadm.ExecOptions(),
128128
})
129129
t.AddStep(&step.ContainerExec{
130-
Command: "tgtd -f &",
130+
Command: "tgtd -f",
131+
Detached: true,
131132
ContainerId: &containerId,
132133
ExecOptions: curveadm.ExecOptions(),
133134
})

0 commit comments

Comments
 (0)