Skip to content

Commit d892175

Browse files
committed
libcontainer: intelrdt: fix a GetStats() issue
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 <[email protected]>
1 parent d5fc10a commit d892175

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libcontainer/intelrdt/intelrdt.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ func (m *IntelRdtManager) GetPath() string {
443443

444444
// Returns statistics for Intel RDT
445445
func (m *IntelRdtManager) GetStats() (*Stats, error) {
446+
// If intelRdt is not specified in config
447+
if m.Config.IntelRdt == nil {
448+
return nil, nil
449+
}
450+
446451
m.mu.Lock()
447452
defer m.mu.Unlock()
448453
stats := NewStats()

0 commit comments

Comments
 (0)