Fix density spec generation
Fixes #3580 Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		@@ -31,7 +31,6 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/containerd/containerd"
 | 
			
		||||
	"github.com/containerd/containerd/cio"
 | 
			
		||||
	"github.com/containerd/containerd/containers"
 | 
			
		||||
	"github.com/containerd/containerd/namespaces"
 | 
			
		||||
	"github.com/containerd/containerd/oci"
 | 
			
		||||
	"github.com/sirupsen/logrus"
 | 
			
		||||
@@ -76,11 +75,6 @@ var densityCommand = cli.Command{
 | 
			
		||||
		s := make(chan os.Signal, 1)
 | 
			
		||||
		signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
 | 
			
		||||
 | 
			
		||||
		spec, err := oci.GenerateSpec(ctx, client,
 | 
			
		||||
			&containers.Container{},
 | 
			
		||||
			oci.WithImageConfig(image),
 | 
			
		||||
			oci.WithProcessArgs("sleep", "120m"),
 | 
			
		||||
		)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
@@ -95,11 +89,13 @@ var densityCommand = cli.Command{
 | 
			
		||||
				break loop
 | 
			
		||||
			default:
 | 
			
		||||
				id := fmt.Sprintf("density-%d", i)
 | 
			
		||||
				spec.Linux.CgroupsPath = filepath.Join("/", "density", id)
 | 
			
		||||
 | 
			
		||||
				c, err := client.NewContainer(ctx, id,
 | 
			
		||||
					containerd.WithNewSnapshot(id, image),
 | 
			
		||||
					containerd.WithSpec(spec, oci.WithUsername("games")),
 | 
			
		||||
					containerd.WithNewSpec(
 | 
			
		||||
						oci.WithImageConfig(image),
 | 
			
		||||
						oci.WithProcessArgs("sleep", "120m"),
 | 
			
		||||
						oci.WithUsername("games")),
 | 
			
		||||
				)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return err
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user