Skip to content

Commit

Permalink
libcontainer: intelrdt: add update command support
Browse files Browse the repository at this point in the history
Add runc update command support for Intel RDT/CAT.

for example:
runc update --l3-cache-schema "L3:0=f;1=f" <container-id>

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
  • Loading branch information
xiaochenshen committed Sep 13, 2017
1 parent 593914b commit b699e7e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strconv"

"github.com/docker/go-units"
"github.com/opencontainers/runc/libcontainer/intelrdt"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -112,6 +113,10 @@ other options are ignored.
Name: "pids-limit",
Usage: "Maximum number of pids allowed in the container",
},
cli.StringFlag{
Name: "l3-cache-schema",
Usage: "The string of Intel RDT/CAT L3 cache schema",
},
},
Action: func(context *cli.Context) error {
if err := checkArgs(context, 1, exactArgs); err != nil {
Expand Down Expand Up @@ -254,6 +259,14 @@ other options are ignored.
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
config.Cgroups.Resources.PidsLimit = r.Pids.Limit

if val := context.String("l3-cache-schema"); val != "" {
// Avoid silent failure in container.Set()
if !intelrdt.IsEnabled() || config.IntelRdt == nil {
return fmt.Errorf("l3 cache schema is not enabled or not specified in config, update value '%s' is discarded", val)
}
config.IntelRdt.L3CacheSchema = val
}

return container.Set(config)
},
}

0 comments on commit b699e7e

Please sign in to comment.