mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-15 19:09:19 +00:00
Make all references to 'Capabilities' explicit to 'DriverCapabilities'
Signed-off-by: Kevin Klues <kklues@nvidia.com>
This commit is contained in:
parent
b3de846f66
commit
c84d80d5ea
@ -22,15 +22,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
allCapabilities = "compute,compat32,graphics,utility,video,display"
|
allDriverCapabilities = "compute,compat32,graphics,utility,video,display"
|
||||||
defaultCapability = "utility"
|
defaultDriverCapabilities = "utility"
|
||||||
)
|
)
|
||||||
|
|
||||||
type nvidiaConfig struct {
|
type nvidiaConfig struct {
|
||||||
Devices string
|
Devices string
|
||||||
Capabilities string
|
DriverCapabilities string
|
||||||
Requirements []string
|
Requirements []string
|
||||||
DisableRequire bool
|
DisableRequire bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type containerConfig struct {
|
type containerConfig struct {
|
||||||
@ -128,7 +128,7 @@ func getDevices(env map[string]string) *string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCapabilities(env map[string]string) *string {
|
func getDriverCapabilities(env map[string]string) *string {
|
||||||
if capabilities, ok := env[envNVDriverCapabilities]; ok {
|
if capabilities, ok := env[envNVDriverCapabilities]; ok {
|
||||||
return &capabilities
|
return &capabilities
|
||||||
}
|
}
|
||||||
@ -163,19 +163,19 @@ func getNvidiaConfigLegacy(env map[string]string) *nvidiaConfig {
|
|||||||
devices = ""
|
devices = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var capabilities string
|
var driverCapabilities string
|
||||||
if c := getCapabilities(env); c == nil {
|
if c := getDriverCapabilities(env); c == nil {
|
||||||
// Environment variable unset: default to "all".
|
// Environment variable unset: default to "all".
|
||||||
capabilities = allCapabilities
|
driverCapabilities = allDriverCapabilities
|
||||||
} else if len(*c) == 0 {
|
} else if len(*c) == 0 {
|
||||||
// Environment variable empty: use default capability.
|
// Environment variable empty: use default capability.
|
||||||
capabilities = defaultCapability
|
driverCapabilities = defaultDriverCapabilities
|
||||||
} else {
|
} else {
|
||||||
// Environment variable non-empty.
|
// Environment variable non-empty.
|
||||||
capabilities = *c
|
driverCapabilities = *c
|
||||||
}
|
}
|
||||||
if capabilities == "all" {
|
if driverCapabilities == "all" {
|
||||||
capabilities = allCapabilities
|
driverCapabilities = allDriverCapabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
requirements := getRequirements(env)
|
requirements := getRequirements(env)
|
||||||
@ -188,10 +188,10 @@ func getNvidiaConfigLegacy(env map[string]string) *nvidiaConfig {
|
|||||||
disableRequire, _ := strconv.ParseBool(env[envNVDisableRequire])
|
disableRequire, _ := strconv.ParseBool(env[envNVDisableRequire])
|
||||||
|
|
||||||
return &nvidiaConfig{
|
return &nvidiaConfig{
|
||||||
Devices: devices,
|
Devices: devices,
|
||||||
Capabilities: capabilities,
|
DriverCapabilities: driverCapabilities,
|
||||||
Requirements: requirements,
|
Requirements: requirements,
|
||||||
DisableRequire: disableRequire,
|
DisableRequire: disableRequire,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,16 +215,16 @@ func getNvidiaConfig(env map[string]string) *nvidiaConfig {
|
|||||||
devices = ""
|
devices = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var capabilities string
|
var driverCapabilities string
|
||||||
if c := getCapabilities(env); c == nil || len(*c) == 0 {
|
if c := getDriverCapabilities(env); c == nil || len(*c) == 0 {
|
||||||
// Environment variable unset or set but empty: use default capability.
|
// Environment variable unset or set but empty: use default capability.
|
||||||
capabilities = defaultCapability
|
driverCapabilities = defaultDriverCapabilities
|
||||||
} else {
|
} else {
|
||||||
// Environment variable set and non-empty.
|
// Environment variable set and non-empty.
|
||||||
capabilities = *c
|
driverCapabilities = *c
|
||||||
}
|
}
|
||||||
if capabilities == "all" {
|
if driverCapabilities == "all" {
|
||||||
capabilities = allCapabilities
|
driverCapabilities = allDriverCapabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
requirements := getRequirements(env)
|
requirements := getRequirements(env)
|
||||||
@ -233,10 +233,10 @@ func getNvidiaConfig(env map[string]string) *nvidiaConfig {
|
|||||||
disableRequire, _ := strconv.ParseBool(env[envNVDisableRequire])
|
disableRequire, _ := strconv.ParseBool(env[envNVDisableRequire])
|
||||||
|
|
||||||
return &nvidiaConfig{
|
return &nvidiaConfig{
|
||||||
Devices: devices,
|
Devices: devices,
|
||||||
Capabilities: capabilities,
|
DriverCapabilities: driverCapabilities,
|
||||||
Requirements: requirements,
|
Requirements: requirements,
|
||||||
DisableRequire: disableRequire,
|
DisableRequire: disableRequire,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ func doPrestart() {
|
|||||||
args = append(args, fmt.Sprintf("--device=%s", nvidia.Devices))
|
args = append(args, fmt.Sprintf("--device=%s", nvidia.Devices))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cap := range strings.Split(nvidia.Capabilities, ",") {
|
for _, cap := range strings.Split(nvidia.DriverCapabilities, ",") {
|
||||||
if len(cap) == 0 {
|
if len(cap) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user