-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Some init code refactoring #3854
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
Conversation
|
@thaJeztah PTAL (I hope this is consumable, changes may look big but mostly it's just moving and removing). |
|
@opencontainers/runc-maintainers can we please merge this one? It really blocks my further work on #3385 and subsequent improvements to libcontainer/README. If there's anything that does not make sense here, please let me know. |
| runtime.LockOSThread() | ||
| if err := libcontainer.StartInitialization(); err != nil { | ||
| logrus.Fatal(err) | ||
| fmt.Fprintln(os.Stderr, err) |
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.
Could you add a comment line to explain why not to use logrus here
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.
Done. I've also removed one commit from this PR.
No code change, just moving a function from factory_linux.go to init_linux.go. Signed-off-by: Kir Kolyshkin <[email protected]>
Instead of having newContainerInit return an interface, and let its caller call Init(), it is easier to call Init directly. Do that, and rename newContainerInit to containerInit. I think it makes the code more readable and straightforward. Signed-off-by: Kir Kolyshkin <[email protected]>
This is a cosmetic change to improve code readability, making it easier to distinguish between a local error and the error being returned. While at it, rename e to err (it was originally called e to not clash with returned error named err) and ee to err2. Signed-off-by: Kir Kolyshkin <[email protected]>
Currently, TestInit sets up logrus, and init uses it to log an error from StartInitialization(). This is solely used by TestExecInError to check that error returned from StartInitialization is the one it expects. Note that the very same error is communicated to the runc init parent and is ultimately returned by container.Run(), so checking what StartInitialization returned is redundant. Remove logrus setup and use from TestMain/init. Signed-off-by: Kir Kolyshkin <[email protected]>
This is a preparation for #3385, separated out for easier review.
This is all cosmetical -- code move and removal, variables renaming, all that jazz.
See individual commits for details.