-
Notifications
You must be signed in to change notification settings - Fork 165
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
Improves logging for the chroot2 utility and introduces EVE_CONTAINER_NO_POWEROFF mode #3628
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3628 +/- ##
==========================================
- Coverage 19.37% 19.36% -0.01%
==========================================
Files 232 232
Lines 50551 50551
==========================================
- Hits 9796 9791 -5
- Misses 40045 40050 +5
Partials 710 710 ☔ View full report in Codecov by Sentry. |
dd60173
to
3b128fa
Compare
Patch improves logging for fatal error path printing all arguments out. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
3b128fa
to
4897866
Compare
4897866
to
45761c9
Compare
Difference to previous version:
|
45761c9
to
4ff689a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM. |
pkg/xen-tools/initrd/chroot2.c
Outdated
return 0; | ||
child_pid = wait(&wstatus); | ||
if (child_pid < 0) | ||
err(-1, "waitpid() failed:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do you intentionally leave the semicolon at the end? It's not critical at all, but just in case...
Except for one typo, it looks fine to me. |
The last commit covers that in the DEBUGGING doc |
Wait for a child exit status and returns it to a caller of a chroor2 caller. Valid expectations are that init (process which is executed by the following execvp() call) never exits, if it does - return an exit status. It is possible to get 0 (success) of a chroot2 execution status iif a spawned child process returned 0. If a child process was terminated by a signal or coredumped (same as terminated by a SIGSEGV), the chroot2 returns -1 (255). Also patch replaces waitpid() on wait() for simplicity, since chroot2 starts only one child there is no reason to specify what child do we wait, wait() call waits for any child and is similar in this context. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
…ation Output all warnings and treat them as errors. This make chroot2.c and hacf.c compilation more strict. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
Add an explicit echo which warns about power off of the whole VM. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
…F is set If container's init script misbehaves and exits, it becomes very difficult to debug such a container, because VM shuts down immediately by explicit poweroff call. This patch introduces an EVE_CONTAINER_NO_POWEROFF flag, which can be set in the application environment variables on the controller side and instead of calling /sbin/poweroff init-initrd sleeps infinitely, waiting for attention from a developer. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
I saw this change, but it only says
I'm confused. What exactly does it mean, "is set on the controller side"? |
4ff689a
to
4c9ca80
Compare
This is the "Add Custom Config Template" section of the edge application. Environment comes with the app config. |
Thanks, now I get it! |
…ariable A few lines in the doc never hurts. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
4c9ca80
to
9a7c625
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR improves logging for the chroot2 utility by printing possible parameters. There is a customer container, which provides invalid WORKDIR in its environment, so that chdir() fails. EVE considers this as fatal (which is ok), but does not print what exact directory does not exist, which is nasty. This PR improves that by err() libc call.
PR propagates an error from to a chroot2 caller and init-initrd scripts prints the exit value. Valid expectations are that init (process which is executed by the following execvp() call) never exits, if it does - return an exit status. It is possible to get 0 (success) of a chroot2 execution status iif a spawned child process returned 0. If a child process was terminated by a signal or coredumped (same as terminated by a SIGSEGV), the chroot2 returns -1 (255).
The last few commits introduce EVE_CONTAINER_NO_POWEROFF flag. If container's init script misbehaves and exits, it becomes very difficult to debug such a container, because VM shuts down immediately by explicit poweroff call. The EVE_CONTAINER_NO_POWEROFF can be set in the application environment variables on the controller side and instead of calling /sbin/poweroff, init-initrd sleeps infinitely, waiting for attention from a developer.
CC: @jsfakian