Support CDI devices in ctr --device flag
This change adds support for CDI devices to the ctr --device flag. If a fully-qualified CDI device name is specified, this is injected into the OCI specification before creating the container. Note that the CDI specifications and the devices that they represent are local and mirror the behaviour of linux devices in the ctr command. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/containers"
|
||||
"github.com/containerd/containerd/oci"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
func isHugetlbControllerPresent() bool {
|
||||
@@ -33,8 +34,8 @@ func SwapControllerAvailable() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// WithCDI does nothing on non Linux platforms.
|
||||
func WithCDI(_ map[string]string) oci.SpecOpts {
|
||||
// WithCDI does nothing on non-Linux platforms.
|
||||
func WithCDI(_ map[string]string, _ []*runtime.CDIDevice) oci.SpecOpts {
|
||||
return func(ctx context.Context, client oci.Client, container *containers.Container, spec *oci.Spec) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user