Skip to content

Conversation

@kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented May 3, 2023

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.

@kolyshkin
Copy link
Contributor Author

@thaJeztah PTAL (I hope this is consumable, changes may look big but mostly it's just moving and removing).

@kolyshkin
Copy link
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.

@kolyshkin kolyshkin added the kind/refactor refactoring label May 12, 2023
runtime.LockOSThread()
if err := libcontainer.StartInitialization(); err != nil {
logrus.Fatal(err)
fmt.Fprintln(os.Stderr, err)
Copy link
Member

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

Copy link
Contributor Author

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.

kolyshkin added 4 commits May 17, 2023 12:46
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]>
@mrunalp mrunalp merged commit a2b60cf into opencontainers:main May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants