Skip to content

Commit 5c51b38

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 b82d07e commit 5c51b38

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

update.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ other options are ignored.
112112
Name: "pids-limit",
113113
Usage: "Maximum number of pids allowed in the container",
114114
},
115+
cli.StringFlag{
116+
Name: "l3-cache-schema",
117+
Usage: "The string of Intel RDT/CAT L3 cache schema",
118+
},
115119
},
116120
Action: func(context *cli.Context) error {
117121
if err := checkArgs(context, 1, exactArgs); err != nil {
@@ -254,6 +258,21 @@ other options are ignored.
254258
config.Cgroups.Resources.MemorySwap = *r.Memory.Swap
255259
config.Cgroups.Resources.PidsLimit = r.Pids.Limit
256260

261+
// If intelRdt is not specified in config
262+
if config.IntelRdt == nil {
263+
return fmt.Errorf("failed to update l3-cache-schema: intelRdt.l3CacheSchema is not specified in config")
264+
}
265+
266+
i := specs.LinuxIntelRdt{
267+
L3CacheSchema: "",
268+
}
269+
270+
if val := context.String("l3-cache-schema"); val != "" {
271+
i.L3CacheSchema = val
272+
}
273+
274+
config.IntelRdt.L3CacheSchema = i.L3CacheSchema
275+
257276
return container.Set(config)
258277
},
259278
}

0 commit comments

Comments
 (0)