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 8, 2017
1 parent b82d07e commit 5c51b38
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,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 +258,21 @@ other options are ignored.
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
config.Cgroups.Resources.PidsLimit = r.Pids.Limit

// If intelRdt is not specified in config
if config.IntelRdt == nil {
return fmt.Errorf("failed to update l3-cache-schema: intelRdt.l3CacheSchema is not specified in config")
}

i := specs.LinuxIntelRdt{
L3CacheSchema: "",
}

if val := context.String("l3-cache-schema"); val != "" {
i.L3CacheSchema = val
}

config.IntelRdt.L3CacheSchema = i.L3CacheSchema

return container.Set(config)
},
}

0 comments on commit 5c51b38

Please sign in to comment.