Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #228 replace start to run #232

Closed
wants to merge 2 commits into from

Conversation

heartlock
Copy link

Signed-off-by: heartlock 21521209@zju.edu.cn

Signed-off-by: heartlock <21521209@zju.edu.cn>
@heartlock heartlock changed the title replace start to run fix issue #228 replace start to run Oct 7, 2016
@Mashimiao
Copy link

This has been talked in #184. I think you'd better separate it into create and start.

@heartlock
Copy link
Author

@Mashimiao good idea, I will update it. but I think when the work of issuse #66 is complete, test_runtime.sh will be removed. I don't know if it is necessary to update it here.

@Mashimiao
Copy link

I think it is, as test_runtime.sh is the only runtime test tool by now.

Signed-off-by: heartlock <21521209@zju.edu.cn>
info "Runtime is ${RUNTIME}, no need to create before start"
else
info "Runtime is ${RUNTIME}, need to create before start"
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If created succeed, we don't need to print. But if failed, we should judge to stop or continue depend on which kind of error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when exitcode of command "${RUNTIME} create ${conID}" is 1, runtime has no command "create" continue to run command "start". If exitcode of command "${RUNTIME} create ${conID}" is -1, runtime create container fail and print error. but I don't know how to get exitcode of command "${RUNTIME} create ${conID}".

Copy link

@Mashimiao Mashimiao Oct 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when executed "${RUNTIME} create ${conID}", you can use $? to get the exit code.
just as
sleep 1
echo $?
0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if runtime has no command "create", execute "${RUNTIME} create ${conID}" will cause a crash.https://github.com/opencontainers/runtime-tools/blob/master/test_runtime.sh#L2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If necessary, I think we can remove it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is unwise to remove it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, just now it's not necessary to remove. You can just error out if failed and continue when created succeed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Sat, Oct 08, 2016 at 07:05:08PM -0700, heartlock wrote:

but if runtime has no command "create"…

Then it's not compliant with opencontainers/runtime-spec#513 or the current create requirements. You can use:

${RUNTIME} create ${conID} || die "failed to create ${conID}"
${RUNTIME} start ${conID} || die "failed to start ${conID}"

with a die command that prints the message to stderr and exits 1.

But the real problem with converting test_runtime.sh to the spec's current create/start API is that the start exit code is not the container process's exit code. You have to do subreaper magic or similar to see how runtimetest exited.

@Mashimiao
Copy link

And there is no need two commits, just one commit will be fine.

@wking wking mentioned this pull request Oct 29, 2016
@Mashimiao
Copy link

carried in #285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants