oci: implement WithRdt
Helper for setting the (Linux) container's RDT parameters. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
This commit is contained in:
		| @@ -141,3 +141,15 @@ var WithAllKnownCapabilities = func(ctx context.Context, client Client, c *conta | |||||||
| func WithoutRunMount(ctx context.Context, client Client, c *containers.Container, s *Spec) error { | func WithoutRunMount(ctx context.Context, client Client, c *containers.Container, s *Spec) error { | ||||||
| 	return WithoutMounts("/run")(ctx, client, c, s) | 	return WithoutMounts("/run")(ctx, client, c, s) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // WithRdt sets the container's RDT parameters | ||||||
|  | func WithRdt(closID, l3CacheSchema, memBwSchema string) SpecOpts { | ||||||
|  | 	return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error { | ||||||
|  | 		s.Linux.IntelRdt = &specs.LinuxIntelRdt{ | ||||||
|  | 			ClosID:        closID, | ||||||
|  | 			L3CacheSchema: l3CacheSchema, | ||||||
|  | 			MemBwSchema:   memBwSchema, | ||||||
|  | 		} | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/containers" | 	"github.com/containerd/containerd/containers" | ||||||
|  | 	"github.com/pkg/errors" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process. | // WithAllCurrentCapabilities propagates the effective capabilities of the caller process to the container process. | ||||||
| @@ -45,3 +46,10 @@ func WithCPUShares(shares uint64) SpecOpts { | |||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // WithRdt sets the container's RDT parameters | ||||||
|  | func WithRdt(closID, l3CacheSchema, memBwSchema string) SpecOpts { | ||||||
|  | 	return func(_ context.Context, _ Client, _ *containers.Container, _ *Spec) error { | ||||||
|  | 		return errors.New("RDT not supported") | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Markus Lehtonen
					Markus Lehtonen