Skip to content

Commit db7314c

Browse files
committed
server,nri: pass any linux scheduler attributes to plugins.
Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 9536cf9 commit db7314c

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

internal/nri/container.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type LinuxContainer interface {
3131
GetOOMScoreAdj() *int
3232
GetCgroupsPath() string
3333
GetIOPriority() *nri.LinuxIOPriority
34+
GetScheduler() *nri.LinuxScheduler
3435
}
3536

3637
func containerToNRI(ctr Container) *nri.Container {

internal/nri/container_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ func linuxContainerToNRI(ctr Container) *nri.LinuxContainer {
1616
OomScoreAdj: nri.Int(lnx.GetOOMScoreAdj()),
1717
CgroupsPath: lnx.GetCgroupsPath(),
1818
IoPriority: lnx.GetIOPriority(),
19+
Scheduler: lnx.GetScheduler(),
1920
}
2021
}

server/nri-api.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,15 @@ func (c *criContainer) GetIOPriority() *api.LinuxIOPriority {
780780
return api.FromOCILinuxIOPriority(spec.Process.IOPriority)
781781
}
782782

783+
func (c *criContainer) GetScheduler() *api.LinuxScheduler {
784+
spec := c.GetSpec()
785+
if spec.Process == nil || spec.Process.Scheduler == nil {
786+
return nil
787+
}
788+
789+
return api.FromOCILinuxScheduler(spec.Process.Scheduler)
790+
}
791+
783792
func (c *criContainer) GetSpec() *rspec.Spec {
784793
if c.spec != nil {
785794
return c.spec

0 commit comments

Comments
 (0)