[lxc-devel] [lxd/master] Nvidia GPUs: only handle card device nodes

brauner on Github lxc-bot at linuxcontainers.org
Thu Mar 29 18:55:31 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 496 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180329/d9c1e519/attachment.bin>
-------------- next part --------------
From 9a7af9f8888e779e783a2221bcfa074b2377dfdf Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 29 Mar 2018 20:54:22 +0200
Subject: [PATCH] Nvidia GPUs: only handle card device nodes

When nvidia.runtime is set to true then additional devices will be handled by
the nvidia tools themselves. So leave them alone.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/container_lxc.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index a0ea90b2b..b40eb99f3 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2045,7 +2045,7 @@ func (c *containerLXC) startCommon() (string, error) {
 				sawNvidia = true
 			}
 
-			if sawNvidia {
+			if sawNvidia && !shared.IsTrue(c.expandedConfig["nvidia.runtime"]) {
 				for _, gpu := range nvidiaDevices {
 					err := c.setupUnixDevice(fmt.Sprintf("unix.%s", k), m, gpu.major, gpu.minor, gpu.path, true)
 					if err != nil {
@@ -4265,7 +4265,7 @@ func (c *containerLXC) Update(args db.ContainerArgs, userRequested bool) error {
 					}
 				}
 
-				if !nvidiaExists {
+				if !nvidiaExists && !shared.IsTrue(c.expandedConfig["nvidia.runtime"]) {
 					for _, gpu := range nvidiaDevices {
 						if !c.deviceExistsInDevicesFolder(fmt.Sprintf("unix.%s", k), gpu.path) {
 							continue
@@ -4385,7 +4385,7 @@ func (c *containerLXC) Update(args db.ContainerArgs, userRequested bool) error {
 					sawNvidia = true
 				}
 
-				if sawNvidia {
+				if sawNvidia && !shared.IsTrue(c.expandedConfig["nvidia.runtime"]) {
 					for _, gpu := range nvidiaDevices {
 						if c.deviceExistsInDevicesFolder(k, gpu.path) {
 							continue


More information about the lxc-devel mailing list