Skip to content

Commit

Permalink
Fix (target start): curveadm target start timeout
Browse files Browse the repository at this point in the history
Signed-off-by: zztaki <[email protected]>
  • Loading branch information
zztaki authored and caoxianfei1 committed Nov 24, 2023
1 parent 580b26d commit 9d83a9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions internal/task/step/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type (
ContainerExec struct {
ContainerId *string
Command string
Detached bool
Success *bool
Out *string
module.ExecOptions
Expand Down Expand Up @@ -289,6 +290,9 @@ func (s *ListContainers) Execute(ctx *context.Context) error {

func (s *ContainerExec) Execute(ctx *context.Context) error {
cli := ctx.Module().DockerCli().ContainerExec(*s.ContainerId, s.Command)
if s.Detached {
cli.AddOption("--detach")
}
out, err := cli.Execute(s.ExecOptions)
return PostHandle(s.Success, s.Out, out, err, errno.ERR_RUN_COMMAND_IN_CONTAINER_FAILED.FD("(%s exec CONTAINER COMMAND)", s.ExecWithEngine))
}
Expand Down
3 changes: 2 additions & 1 deletion internal/task/task/bs/start_tgtd.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ func NewStartTargetDaemonTask(curveadm *cli.CurveAdm, cc *configure.ClientConfig
ExecOptions: curveadm.ExecOptions(),
})
t.AddStep(&step.ContainerExec{
Command: "tgtd -f &",
Command: "tgtd -f",
Detached: true,
ContainerId: &containerId,
ExecOptions: curveadm.ExecOptions(),
})
Expand Down

0 comments on commit 9d83a9c

Please sign in to comment.