@@ -83,6 +83,9 @@ type JailerConfig struct {
83
83
// ChrootStrategy will dictate how files are transfered to the root drive.
84
84
ChrootStrategy HandlersAdapter
85
85
86
+ // CgroupVersion is the version of the cgroup filesystem to use.
87
+ CgroupVersion string
88
+
86
89
// Stdout specifies the IO writer for STDOUT to use when spawning the jailer.
87
90
Stdout io.Writer
88
91
// Stderr specifies the IO writer for STDERR to use when spawning the jailer.
@@ -106,6 +109,7 @@ type JailerCommandBuilder struct {
106
109
netNS string
107
110
daemonize bool
108
111
firecrackerArgs []string
112
+ cgroupVersion string
109
113
110
114
stdin io.Reader
111
115
stdout io.Writer
@@ -140,6 +144,10 @@ func (b JailerCommandBuilder) Args() []string {
140
144
args = append (args , "--cgroup" , fmt .Sprintf ("cpuset.cpus=%s" , cpulist ))
141
145
}
142
146
147
+ if len (b .cgroupVersion ) > 0 {
148
+ args = append (args , "--cgroup-version" , b .cgroupVersion )
149
+ }
150
+
143
151
if len (b .chrootBaseDir ) > 0 {
144
152
args = append (args , "--chroot-base-dir" , b .chrootBaseDir )
145
153
}
@@ -271,6 +279,12 @@ func (b JailerCommandBuilder) WithFirecrackerArgs(args ...string) JailerCommandB
271
279
return b
272
280
}
273
281
282
+ // WithCgroupVersion specifies which cgroup version to use
283
+ func (b JailerCommandBuilder ) WithCgroupVersion (version string ) JailerCommandBuilder {
284
+ b .cgroupVersion = version
285
+ return b
286
+ }
287
+
274
288
// Build will build a jailer command.
275
289
func (b JailerCommandBuilder ) Build (ctx context.Context ) * exec.Cmd {
276
290
cmd := exec .CommandContext (
@@ -334,6 +348,7 @@ func jail(ctx context.Context, m *Machine, cfg *Config) error {
334
348
WithExecFile (cfg .JailerCfg .ExecFile ).
335
349
WithChrootBaseDir (cfg .JailerCfg .ChrootBaseDir ).
336
350
WithDaemonize (cfg .JailerCfg .Daemonize ).
351
+ WithCgroupVersion (cfg .JailerCfg .CgroupVersion ).
337
352
WithFirecrackerArgs (fcArgs ... ).
338
353
WithStdout (stdout ).
339
354
WithStderr (stderr )
0 commit comments