Add ctr support for CPUMax and CPUShares

Adds CPU.Maximum and CPU.Shares support to the ctr
cmdline for testing

Signed-off-by: Justin Terry <jlterry@amazon.com>
This commit is contained in:
Justin Terry
2022-04-14 15:21:21 -07:00
parent 0f5d4ff0ff
commit 227156dac6
4 changed files with 54 additions and 13 deletions

View File

@@ -143,6 +143,14 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
if ccount != 0 {
opts = append(opts, oci.WithWindowsCPUCount(ccount))
}
cshares := context.Uint64("cpu-shares")
if cshares != 0 {
opts = append(opts, oci.WithWindowsCPUShares(uint16(cshares)))
}
cmax := context.Uint64("cpu-max")
if cmax != 0 {
opts = append(opts, oci.WithWindowsCPUMaximum(uint16(cmax)))
}
for _, dev := range context.StringSlice("device") {
parts := strings.Split(dev, "://")
if len(parts) != 2 {