@@ -100,6 +100,7 @@ type CreateOpts struct {
100100 NoNewKeyring bool
101101 ExtraFiles []* os.File
102102 Started chan <- int
103+ ExtraArgs []string
103104}
104105
105106func (o * CreateOpts ) args () (out []string , err error ) {
@@ -125,6 +126,9 @@ func (o *CreateOpts) args() (out []string, err error) {
125126 if o .ExtraFiles != nil {
126127 out = append (out , "--preserve-fds" , strconv .Itoa (len (o .ExtraFiles )))
127128 }
129+ if len (o .ExtraArgs ) > 0 {
130+ out = append (out , o .ExtraArgs ... )
131+ }
128132 return out , nil
129133}
130134
@@ -182,6 +186,7 @@ type ExecOpts struct {
182186 ConsoleSocket ConsoleSocket
183187 Detach bool
184188 Started chan <- int
189+ ExtraArgs []string
185190}
186191
187192func (o * ExecOpts ) args () (out []string , err error ) {
@@ -198,6 +203,9 @@ func (o *ExecOpts) args() (out []string, err error) {
198203 }
199204 out = append (out , "--pid-file" , abs )
200205 }
206+ if len (o .ExtraArgs ) > 0 {
207+ out = append (out , o .ExtraArgs ... )
208+ }
201209 return out , nil
202210}
203211
@@ -292,13 +300,17 @@ func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts)
292300
293301// DeleteOpts holds the deletion options for calling `runc delete`
294302type DeleteOpts struct {
295- Force bool
303+ Force bool
304+ ExtraArgs []string
296305}
297306
298307func (o * DeleteOpts ) args () (out []string ) {
299308 if o .Force {
300309 out = append (out , "--force" )
301310 }
311+ if len (o .ExtraArgs ) > 0 {
312+ out = append (out , o .ExtraArgs ... )
313+ }
302314 return out
303315}
304316
@@ -313,13 +325,17 @@ func (r *Runc) Delete(context context.Context, id string, opts *DeleteOpts) erro
313325
314326// KillOpts specifies options for killing a container and its processes
315327type KillOpts struct {
316- All bool
328+ All bool
329+ ExtraArgs []string
317330}
318331
319332func (o * KillOpts ) args () (out []string ) {
320333 if o .All {
321334 out = append (out , "--all" )
322335 }
336+ if len (o .ExtraArgs ) > 0 {
337+ out = append (out , o .ExtraArgs ... )
338+ }
323339 return out
324340}
325341
@@ -461,6 +477,7 @@ type CheckpointOpts struct {
461477 LazyPages bool
462478 // StatusFile is the file criu writes \0 to once lazy-pages is ready
463479 StatusFile * os.File
480+ ExtraArgs []string
464481}
465482
466483// CgroupMode defines the cgroup mode used for checkpointing
@@ -509,6 +526,9 @@ func (o *CheckpointOpts) args() (out []string) {
509526 if o .LazyPages {
510527 out = append (out , "--lazy-pages" )
511528 }
529+ if len (o .ExtraArgs ) > 0 {
530+ out = append (out , o .ExtraArgs ... )
531+ }
512532 return out
513533}
514534
@@ -557,6 +577,7 @@ type RestoreOpts struct {
557577 NoSubreaper bool
558578 NoPivot bool
559579 ConsoleSocket ConsoleSocket
580+ ExtraArgs []string
560581}
561582
562583func (o * RestoreOpts ) args () ([]string , error ) {
@@ -580,6 +601,9 @@ func (o *RestoreOpts) args() ([]string, error) {
580601 if o .NoSubreaper {
581602 out = append (out , "-no-subreaper" )
582603 }
604+ if len (o .ExtraArgs ) > 0 {
605+ out = append (out , o .ExtraArgs ... )
606+ }
583607 return out , nil
584608}
585609
@@ -695,6 +719,9 @@ func (r *Runc) args() (out []string) {
695719 // nil stands for "auto" (differs from explicit "false")
696720 out = append (out , "--rootless=" + strconv .FormatBool (* r .Rootless ))
697721 }
722+ if len (r .ExtraArgs ) > 0 {
723+ out = append (out , r .ExtraArgs ... )
724+ }
698725 return out
699726}
700727
0 commit comments