mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-02-16 17:42:20 +00:00
Add NewContainerEdits utility function
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
046d761f4c
commit
3140810c95
@ -64,9 +64,7 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
|
|||||||
return nil, fmt.Errorf("failed to discover hooks: %v", err)
|
return nil, fmt.Errorf("failed to discover hooks: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := cdi.ContainerEdits{
|
c := NewContainerEdits()
|
||||||
ContainerEdits: &specs.ContainerEdits{},
|
|
||||||
}
|
|
||||||
for _, d := range devices {
|
for _, d := range devices {
|
||||||
edits, err := device(d).toEdits()
|
edits, err := device(d).toEdits()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -83,7 +81,15 @@ func FromDiscoverer(d discover.Discover) (*cdi.ContainerEdits, error) {
|
|||||||
c.Append(hook(h).toEdits())
|
c.Append(hook(h).toEdits())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &c, nil
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewContainerEdits is a utility function to create a CDI ContainerEdits struct.
|
||||||
|
func NewContainerEdits() *cdi.ContainerEdits {
|
||||||
|
c := cdi.ContainerEdits{
|
||||||
|
ContainerEdits: &specs.ContainerEdits{},
|
||||||
|
}
|
||||||
|
return &c
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify applies the defined edits to the incoming OCI spec
|
// Modify applies the defined edits to the incoming OCI spec
|
||||||
|
Loading…
Reference in New Issue
Block a user