Merge pull request #3656 from crosbymichael/stress
Fix density spec generation
This commit is contained in:
commit
c3452abae4
@ -31,7 +31,6 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/cio"
|
"github.com/containerd/containerd/cio"
|
||||||
"github.com/containerd/containerd/containers"
|
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -76,11 +75,6 @@ var densityCommand = cli.Command{
|
|||||||
s := make(chan os.Signal, 1)
|
s := make(chan os.Signal, 1)
|
||||||
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -95,11 +89,13 @@ var densityCommand = cli.Command{
|
|||||||
break loop
|
break loop
|
||||||
default:
|
default:
|
||||||
id := fmt.Sprintf("density-%d", i)
|
id := fmt.Sprintf("density-%d", i)
|
||||||
spec.Linux.CgroupsPath = filepath.Join("/", "density", id)
|
|
||||||
|
|
||||||
c, err := client.NewContainer(ctx, id,
|
c, err := client.NewContainer(ctx, id,
|
||||||
containerd.WithNewSnapshot(id, image),
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user