Merge pull request #5604 from ktock/nvidiacgroups

Allow to pass --no-cgroups option to nvidia-container-cli
This commit is contained in:
Phil Estes 2021-06-14 14:35:00 -04:00 committed by GitHub
commit 0a3a77bc44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,7 @@ type config struct {
LDConfig string
Requirements []string
OCIHookPath string
NoCgroups bool
}
func (c *config) args() []string {
@ -137,6 +138,9 @@ func (c *config) args() []string {
for _, r := range c.Requirements {
args = append(args, fmt.Sprintf("--require=%s", r))
}
if c.NoCgroups {
args = append(args, "--no-cgroups")
}
args = append(args, "--pid={{pid}}", "{{rootfs}}")
return args
}
@ -209,3 +213,9 @@ func WithLookupOCIHookPath(name string) Opts {
return nil
}
}
// WithNoCgroups passes --no-cgroups option to nvidia-container-cli.
func WithNoCgroups(c *config) error {
c.NoCgroups = true
return nil
}