Merge pull request #5490 from askervin/5Bu_blockio

Support for cgroups blockio
This commit is contained in:
Mike Brown
2022-04-29 10:07:56 -05:00
committed by GitHub
27 changed files with 1898 additions and 7 deletions

View File

@@ -189,6 +189,14 @@ var (
Name: "apparmor-profile",
Usage: "enable AppArmor with an existing custom profile",
},
cli.StringFlag{
Name: "blockio-config-file",
Usage: "file path to blockio class definitions. By default class definitions are not loaded.",
},
cli.StringFlag{
Name: "blockio-class",
Usage: "name of the blockio class to associate the container with",
},
cli.StringFlag{
Name: "rdt-class",
Usage: "name of the RDT class to associate the container with. Specifies a Class of Service (CLOS) for cache and memory bandwidth management.",

View File

@@ -39,6 +39,7 @@ import (
"github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/containerd/snapshots"
"github.com/intel/goresctrl/pkg/blockio"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@@ -329,6 +330,19 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
})
}
if c := context.String("blockio-config-file"); c != "" {
if err := blockio.SetConfigFromFile(c, false); err != nil {
return nil, fmt.Errorf("blockio-config-file error: %w", err)
}
}
if c := context.String("blockio-class"); c != "" {
if linuxBlockIO, err := blockio.OciLinuxBlockIO(c); err == nil {
opts = append(opts, oci.WithBlockIO(linuxBlockIO))
} else {
return nil, fmt.Errorf("blockio-class error: %w", err)
}
}
if c := context.String("rdt-class"); c != "" {
opts = append(opts, oci.WithRdt(c, "", ""))
}