Skip to content

Commit 976428a

Browse files
Merge branch '1.1.0-staging' into 'master'
1.1.0 staging See merge request nvidia/container-toolkit/container-toolkit!7
2 parents 4e4de76 + 2c15e81 commit 976428a

File tree

12 files changed

+296
-29
lines changed

12 files changed

+296
-29
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MKDIR ?= mkdir
55
DIST_DIR ?= $(CURDIR)/dist
66

77
LIB_NAME := nvidia-container-toolkit
8-
LIB_VERSION := 1.0.5
8+
LIB_VERSION := 1.1.0
99

1010
GOLANG_VERSION := 1.14.2
1111
GOLANG_PKG_PATH := github.com/NVIDIA/container-toolkit/pkg

config/config.toml.amzn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load-kmods = true
1111
#no-cgroups = false
1212
#user = "root:video"
1313
ldconfig = "@/sbin/ldconfig"
14+
#alpha-merge-visible-devices-envvars = false
1415

1516
[nvidia-container-runtime]
1617
#debug = "/var/log/nvidia-container-runtime.log"

config/config.toml.centos

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load-kmods = true
1111
#no-cgroups = false
1212
#user = "root:video"
1313
ldconfig = "@/sbin/ldconfig"
14+
#alpha-merge-visible-devices-envvars = false
1415

1516
[nvidia-container-runtime]
1617
#debug = "/var/log/nvidia-container-runtime.log"

config/config.toml.debian

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load-kmods = true
1111
#no-cgroups = false
1212
#user = "root:video"
1313
ldconfig = "@/sbin/ldconfig"
14+
#alpha-merge-visible-devices-envvars = false
1415

1516
[nvidia-container-runtime]
1617
#debug = "/var/log/nvidia-container-runtime.log"

config/config.toml.opensuse-leap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load-kmods = true
1111
#no-cgroups = false
1212
user = "root:video"
1313
ldconfig = "@/sbin/ldconfig"
14+
#alpha-merge-visible-devices-envvars = false
1415

1516
[nvidia-container-runtime]
1617
#debug = "/var/log/nvidia-container-runtime.log"

config/config.toml.ubuntu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load-kmods = true
1111
#no-cgroups = false
1212
#user = "root:video"
1313
ldconfig = "@/sbin/ldconfig.real"
14+
#alpha-merge-visible-devices-envvars = false
1415

1516
[nvidia-container-runtime]
1617
#debug = "/var/log/nvidia-container-runtime.log"

container_config_test.go

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
package main
2+
3+
import (
4+
"github.com/stretchr/testify/require"
5+
"sort"
6+
"strings"
7+
"testing"
8+
)
9+
10+
func TestMergeVisibleDevicesEnvvars(t *testing.T) {
11+
var tests = []struct {
12+
name string
13+
input []string
14+
expected string
15+
enableMerge bool
16+
}{
17+
{
18+
"Simple Merge Enabled",
19+
[]string{
20+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
21+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
22+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
23+
},
24+
"0,1,2,3,4,5",
25+
true,
26+
},
27+
{
28+
"Simple Merge Disabled",
29+
[]string{
30+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
31+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
32+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
33+
},
34+
"",
35+
false,
36+
},
37+
{
38+
"Merge No Override (Enabled)",
39+
[]string{
40+
"NVIDIA_VISIBLE_DEVICES=all",
41+
},
42+
"all",
43+
true,
44+
},
45+
{
46+
"Merge No Override (Disabled)",
47+
[]string{
48+
"NVIDIA_VISIBLE_DEVICES=all",
49+
},
50+
"all",
51+
false,
52+
},
53+
{
54+
"Merge Override (Enabled, Before)",
55+
[]string{
56+
"NVIDIA_VISIBLE_DEVICES=all",
57+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
58+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
59+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
60+
},
61+
"0,1,2,3,4,5",
62+
true,
63+
},
64+
{
65+
"Merge Override (Enabled, After)",
66+
[]string{
67+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
68+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
69+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
70+
"NVIDIA_VISIBLE_DEVICES=all",
71+
},
72+
"0,1,2,3,4,5",
73+
true,
74+
},
75+
{
76+
"Merge Override (Enabled, In Between)",
77+
[]string{
78+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
79+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
80+
"NVIDIA_VISIBLE_DEVICES=all",
81+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
82+
},
83+
"0,1,2,3,4,5",
84+
true,
85+
},
86+
{
87+
"Merge Override (Disabled, Before)",
88+
[]string{
89+
"NVIDIA_VISIBLE_DEVICES=all",
90+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
91+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
92+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
93+
},
94+
"all",
95+
false,
96+
},
97+
{
98+
"Merge Override (Disabled, After)",
99+
[]string{
100+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
101+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
102+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
103+
"NVIDIA_VISIBLE_DEVICES=all",
104+
},
105+
"all",
106+
false,
107+
},
108+
{
109+
"Merge Override (Disabled, In Between)",
110+
[]string{
111+
"NVIDIA_VISIBLE_DEVICES_0=0,1",
112+
"NVIDIA_VISIBLE_DEVICES_1=2,3",
113+
"NVIDIA_VISIBLE_DEVICES=all",
114+
"NVIDIA_VISIBLE_DEVICES_WHATEVER=4,5",
115+
},
116+
"all",
117+
false,
118+
},
119+
}
120+
for _, tc := range tests {
121+
t.Run(tc.name, func(t *testing.T) {
122+
config := CLIConfig{
123+
AlphaMergeVisibleDevicesEnvvars: tc.enableMerge,
124+
}
125+
envvars := getEnvMap(tc.input, config)
126+
devices := strings.Split(envvars[envNVVisibleDevices], ",")
127+
sort.Strings(devices)
128+
require.Equal(t, tc.expected, strings.Join(devices, ","))
129+
})
130+
}
131+
}

packaging/debian/changelog

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
nvidia-container-toolkit (@VERSION@) UNRELEASED; urgency=medium
1+
nvidia-container-toolkit (1.1.0-1) UNRELEASED; urgency=medium
2+
3+
* Add ability to merge envars of the form NVIDIA_VISIBLE_DEVICES_* (Closes: #XXXXXX)
4+
* Extend fields we inspect in the runc spec to include linux capabilities (Closes: #XXXXXX)
5+
* Add support for MIG (Closes: #XXXXXX)
6+
7+
-- NVIDIA CORPORATION <[email protected]> Wed, 07 Mar 2018 05:47:37 +0000
8+
9+
nvidia-container-toolkit (1.0.5-1) UNRELEASED; urgency=medium
210

311
* Initial release. Replaces older package nvidia-container-runtime-hook. (Closes: #XXXXXX)
412

packaging/rpm/SPECS/nvidia-container-toolkit.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ rm -f %{_bindir}/nvidia-container-runtime-hook
5353
/usr/share/containers/oci/hooks.d/oci-nvidia-hook.json
5454

5555
%changelog
56+
* Fri May 15 2020 NVIDIA CORPORATION <[email protected]> 1.1.0-1
57+
- Add ability to merge envars of the form NVIDIA_VISIBLE_DEVICES_*
58+
- Extend fields we inspect in the runc spec to include linux capabilities
59+
- Add support for MIG

0 commit comments

Comments
 (0)