Skip to content

Derive cpuinfo as needed, instead of at init-time#4953

Merged
mxpv merged 1 commit intocontainerd:masterfrom
imjasonh:cpuinfo
Jan 19, 2021
Merged

Derive cpuinfo as needed, instead of at init-time#4953
mxpv merged 1 commit intocontainerd:masterfrom
imjasonh:cpuinfo

Conversation

@imjasonh
Copy link
Copy Markdown
Contributor

This changes platforms.Parse to hit /proc to look up CPU info only when it's needed, instead of in init(). This makes the package a bit easier for other packages to consume, especially clients that don't call platforms.Parse or need to lookup CPU info.

This recently came up in google/go-containerregistry#916 since go-containerregistry imports moby/moby, which imports containerd/containerd/platforms to call platforms.Parse when starting a container -- go-containerregistry never starts containers and doesn't care about the value of platforms.Parse or cpuInfo.

cc @jonjohnsonjr

@k8s-ci-robot
Copy link
Copy Markdown

Hi @imjasonh. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

This changes platforms.Parse to hit /proc to look up CPU info only when
it's needed, instead of in init(). This makes the package a bit easier
for other packages to consume, especially clients that don't call
platforms.Parse or need to lookup CPU info.

Signed-off-by: Jason Hall <[email protected]>
@crosbymichael
Copy link
Copy Markdown
Member

/ok-to-test

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jan 19, 2021

Build succeeded.

@mxpv mxpv merged commit 9c3f171 into containerd:master Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants