containerd-stress: add snapshotter option for stress test to use

containerd-stress utility needs to be able to run with snapshotter
passed by user in cli in order to be able to stress test snapshotters.
This adds a cli option --snapshotter="<snapshotter-name>"

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
This commit is contained in:
Alakesh Haloi
2021-04-06 22:54:59 +00:00
parent 054a3e281e
commit 0550c32330
4 changed files with 29 additions and 15 deletions

View File

@@ -35,9 +35,10 @@ type worker struct {
count int
failures int
client *containerd.Client
image containerd.Image
commit string
client *containerd.Client
image containerd.Image
commit string
snapshotter string
}
func (w *worker) run(ctx, tctx context.Context) {
@@ -74,6 +75,7 @@ func (w *worker) run(ctx, tctx context.Context) {
func (w *worker) runContainer(ctx context.Context, id string) (err error) {
// fix up cgroups path for a default config
c, err := w.client.NewContainer(ctx, id,
containerd.WithSnapshotter(w.snapshotter),
containerd.WithNewSnapshot(id, w.image),
containerd.WithNewSpec(oci.WithImageConfig(w.image), oci.WithUsername("games"), oci.WithProcessArgs("true")),
)