Skip to content

Commit 9536cf9

Browse files
committed
server,nri: pass any linux I/O priority to plugins.
Signed-off-by: Krisztian Litkey <[email protected]>
1 parent b23a7d0 commit 9536cf9

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
@@ -30,6 +30,7 @@ type LinuxContainer interface {
3030
GetLinuxResources() *nri.LinuxResources
3131
GetOOMScoreAdj() *int
3232
GetCgroupsPath() string
33+
GetIOPriority() *nri.LinuxIOPriority
3334
}
3435

3536
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
@@ -15,5 +15,6 @@ func linuxContainerToNRI(ctr Container) *nri.LinuxContainer {
1515
Resources: lnx.GetLinuxResources(),
1616
OomScoreAdj: nri.Int(lnx.GetOOMScoreAdj()),
1717
CgroupsPath: lnx.GetCgroupsPath(),
18+
IoPriority: lnx.GetIOPriority(),
1819
}
1920
}

server/nri-api.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,15 @@ func (c *criContainer) GetCgroupsPath() string {
771771
return c.GetSpec().Linux.CgroupsPath
772772
}
773773

774+
func (c *criContainer) GetIOPriority() *api.LinuxIOPriority {
775+
spec := c.GetSpec()
776+
if spec.Process == nil {
777+
return nil
778+
}
779+
780+
return api.FromOCILinuxIOPriority(spec.Process.IOPriority)
781+
}
782+
774783
func (c *criContainer) GetSpec() *rspec.Spec {
775784
if c.spec != nil {
776785
return c.spec

0 commit comments

Comments
 (0)