Skip to content

Commit

Permalink
libcontainer: intelrdt: fix a GetStats() issue
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xiaochenshen committed Oct 17, 2017
1 parent d5fc10a commit d892175
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libcontainer/intelrdt/intelrdt.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ func (m *IntelRdtManager) GetPath() string {

// Returns statistics for Intel RDT
func (m *IntelRdtManager) GetStats() (*Stats, error) {
// If intelRdt is not specified in config
if m.Config.IntelRdt == nil {
return nil, nil
}

m.mu.Lock()
defer m.mu.Unlock()
stats := NewStats()
Expand Down

0 comments on commit d892175

Please sign in to comment.