libcontainer: intelrdt: fix a GetStats() issue#1615
Merged
cyphar merged 1 commit intoopencontainers:masterfrom Oct 18, 2017
Merged
libcontainer: intelrdt: fix a GetStats() issue#1615cyphar merged 1 commit intoopencontainers:masterfrom
cyphar merged 1 commit intoopencontainers:masterfrom
Conversation
This fixes a GetStats() issue introduced in opencontainers#1590: If Intel RDT is enabled by hardware and kernel, but intelRdt is not specified in original config, GetStats() will return error unexpectedly because we haven't called Apply() to create intelrdt group or attach tasks for this container. As a result, runc events command will have no output. Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
| func (m *IntelRdtManager) GetStats() (*Stats, error) { | ||
| // If intelRdt is not specified in config | ||
| if m.Config.IntelRdt == nil { | ||
| return nil, nil |
Member
There was a problem hiding this comment.
Does the calling code handle a nil, nil return or will it panic?
Contributor
Author
There was a problem hiding this comment.
Does the calling code handle a nil, nil return or will it panic?
It will not panic. In caller linuxContainer.Stats(): libcontainer.Stats.IntelRdtStats will be assigned to nil when intelRdtManager.GetStats() returns nil, nil.
And in events command, the caller convertLibcontainerStats() will handle the case when libcontainer.Stats.IntelRdtStats = nil
Member
Member
cyphar
added a commit
that referenced
this pull request
Oct 18, 2017
libcontainer: intelrdt: fix a GetStats() issue LGTMs: @crosbymichael @cyphar Closes #1615
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 fixes a GetStats() issue introduced in #1590:
If Intel RDT is enabled by hardware and kernel, but intelRdt is not
specified in original config, GetStats() will return error unexpectedly
because we haven't called Apply() to create intelrdt group or attach
tasks for this container. As a result, runc events command will have no
output.
Signed-off-by: Xiaochen Shen xiaochen.shen@intel.com