Skip to content

Commit 1fe4b4e

Browse files
committed
libcontainer: intelrdt: add update command support
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 <[email protected]>
1 parent f1e19e9 commit 1fe4b4e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

update.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"strconv"
1010

1111
"github.com/docker/go-units"
12+
"github.com/opencontainers/runc/libcontainer/configs"
13+
"github.com/opencontainers/runc/libcontainer/intelrdt"
1214
"github.com/opencontainers/runtime-spec/specs-go"
1315
"github.com/urfave/cli"
1416
)
@@ -112,6 +114,10 @@ other options are ignored.
112114
Name: "pids-limit",
113115
Usage: "Maximum number of pids allowed in the container",
114116
},
117+
cli.StringFlag{
118+
Name: "l3-cache-schema",
119+
Usage: "The string of Intel RDT/CAT L3 cache schema",
120+
},
115121
},
116122
Action: func(context *cli.Context) error {
117123
if err := checkArgs(context, 1, exactArgs); err != nil {
@@ -254,6 +260,17 @@ other options are ignored.
254260
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
255261
config.Cgroups.Resources.PidsLimit = r.Pids.Limit
256262

263+
if val := context.String("l3-cache-schema"); val != "" {
264+
// Avoid silent failure in container.Set()
265+
if !intelrdt.IsEnabled() || config.IntelRdt == nil {
266+
return fmt.Errorf("l3 cache schema is not enabled or not specified in config, update value '%s' is discarded", val)
267+
}
268+
if config.IntelRdt == nil {
269+
config.IntelRdt = &configs.IntelRdt{}
270+
}
271+
config.IntelRdt.L3CacheSchema = val
272+
}
273+
257274
return container.Set(config)
258275
},
259276
}

0 commit comments

Comments
 (0)