Some init code refactoring#3854
Merged
mrunalp merged 4 commits intoopencontainers:mainfrom May 17, 2023
Merged
Conversation
Merged
Contributor
Author
|
@thaJeztah PTAL (I hope this is consumable, changes may look big but mostly it's just moving and removing). |
Contributor
Author
|
@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. |
AkihiroSuda
reviewed
May 12, 2023
| runtime.LockOSThread() | ||
| if err := libcontainer.StartInitialization(); err != nil { | ||
| logrus.Fatal(err) | ||
| fmt.Fprintln(os.Stderr, err) |
Member
There was a problem hiding this comment.
Could you add a comment line to explain why not to use logrus here
Contributor
Author
There was a problem hiding this comment.
Done. I've also removed one commit from this PR.
AkihiroSuda
approved these changes
May 16, 2023
AkihiroSuda
approved these changes
May 16, 2023
No code change, just moving a function from factory_linux.go to init_linux.go. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
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 <kolyshkin@gmail.com>
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 <kolyshkin@gmail.com>
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 <kolyshkin@gmail.com>
mrunalp
approved these changes
May 17, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.