|
9 | 9 | "strconv" |
10 | 10 |
|
11 | 11 | "github.com/docker/go-units" |
| 12 | + "github.com/opencontainers/runc/libcontainer/configs" |
| 13 | + "github.com/opencontainers/runc/libcontainer/intelrdt" |
12 | 14 | "github.com/opencontainers/runtime-spec/specs-go" |
13 | 15 | "github.com/urfave/cli" |
14 | 16 | ) |
@@ -112,6 +114,10 @@ other options are ignored. |
112 | 114 | Name: "pids-limit", |
113 | 115 | Usage: "Maximum number of pids allowed in the container", |
114 | 116 | }, |
| 117 | + cli.StringFlag{ |
| 118 | + Name: "l3-cache-schema", |
| 119 | + Usage: "The string of Intel RDT/CAT L3 cache schema", |
| 120 | + }, |
115 | 121 | }, |
116 | 122 | Action: func(context *cli.Context) error { |
117 | 123 | if err := checkArgs(context, 1, exactArgs); err != nil { |
@@ -254,6 +260,17 @@ other options are ignored. |
254 | 260 | config.Cgroups.Resources.MemorySwap = *r.Memory.Swap |
255 | 261 | config.Cgroups.Resources.PidsLimit = r.Pids.Limit |
256 | 262 |
|
| 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 | + |
257 | 274 | return container.Set(config) |
258 | 275 | }, |
259 | 276 | } |
0 commit comments