@@ -258,7 +258,7 @@ func (j *runcJailer) BuildJailedRootHandler(cfg *config.Config, machineConfig *f
258
258
j .logger .Debugf ("Writing %q for runc" , rootPathToConfig )
259
259
// we pass m.Cfg as opposed to machineConfig as we want the populated
260
260
// config defaults when calling NewMachine
261
- if err := j .overwriteConfig (cfg , & m .Cfg , filepath .Base (m .Cfg .SocketPath ), rootPathToConfig ); err != nil {
261
+ if err := j .overwriteConfig (& m .Cfg , filepath .Base (m .Cfg .SocketPath ), rootPathToConfig ); err != nil {
262
262
return errors .Wrap (err , "failed to overwrite config.json" )
263
263
}
264
264
@@ -478,7 +478,7 @@ func (j *runcJailer) jailerCommand(containerName string, isDebug bool) *exec.Cmd
478
478
}
479
479
480
480
// overwriteConfig will set the proper default values if a field had not been set.
481
- func (j * runcJailer ) overwriteConfig (cfg * config. Config , machineConfig * firecracker.Config , socketPath , configPath string ) error {
481
+ func (j * runcJailer ) overwriteConfig (machineConfig * firecracker.Config , socketPath , configPath string ) error {
482
482
spec := j .configSpec
483
483
if spec .Process .User .UID != 0 ||
484
484
spec .Process .User .GID != 0 {
@@ -489,7 +489,7 @@ func (j *runcJailer) overwriteConfig(cfg *config.Config, machineConfig *firecrac
489
489
)
490
490
}
491
491
492
- spec = j .setDefaultConfigValues (cfg , socketPath , spec )
492
+ spec = j .setDefaultConfigValues (socketPath , spec )
493
493
spec .Root .Path = rootfsFolder
494
494
spec .Root .Readonly = false
495
495
spec .Process .User .UID = j .Config .UID
@@ -537,24 +537,21 @@ func (j runcJailer) CgroupPath() string {
537
537
return filepath .Join (basePath , j .vmID )
538
538
}
539
539
540
- // setDefaultConfigValues will process the spec file provided and allow any
541
- // empty/zero values to be replaced with default values.
542
- func (j * runcJailer ) setDefaultConfigValues (cfg * config.Config , socketPath string , spec specs.Spec ) specs.Spec {
540
+ // setDefaultConfigValues will override the spec to start Firecracker inside.
541
+ func (j * runcJailer ) setDefaultConfigValues (socketPath string , spec specs.Spec ) specs.Spec {
543
542
if spec .Process == nil {
544
543
spec .Process = & specs.Process {}
545
544
}
546
545
547
- if spec .Process .Args == nil {
548
- cmd := firecracker.VMCommandBuilder {}.
549
- WithBin ("/" + firecrackerFileName ).
550
- WithSocketPath (socketPath ).
551
- WithArgs ([]string {"--id" , j .vmID }).
552
- // Don't need to pass in an actual context here as we are only building
553
- // the command arguments and not actually building a command
554
- Build (context .Background ())
546
+ cmd := firecracker.VMCommandBuilder {}.
547
+ WithBin ("/" + firecrackerFileName ).
548
+ WithSocketPath (socketPath ).
549
+ WithArgs ([]string {"--id" , j .vmID }).
550
+ // Don't need to pass in an actual context here as we are only building
551
+ // the command arguments and not actually building a command
552
+ Build (context .Background ())
555
553
556
- spec .Process .Args = cmd .Args
557
- }
554
+ spec .Process .Args = cmd .Args
558
555
559
556
cgroupPath := j .CgroupPath ()
560
557
j .logger .WithField ("CgroupPath" , cgroupPath ).Debug ("using cgroup path" )
0 commit comments