Register container name with kernel before Loader.createContainerProcess().

Loader.createContainerProcess() => createDeviceFiles() calls
devutil.GoferClientFromContext() when using nvidia-container-runtime-hook.
devutil.GoferClientFromContext() expects `Kernel.containerNames` map to be
initialized with the current container's ID -> name mapping.

However, for sub-containers we were not initializing this map before
Loader.createContainerProcess(). This change fixes that. We hadn't hit this yet
because we never had multi-container usages of nvidia-container-runtime-hook.

Updates #10997

PiperOrigin-RevId: 683256638
This commit is contained in:
Ayush Ranjan
2024-10-07 11:26:40 -07:00
committed by gVisor bot
parent 1ea84d6db0
commit 0fae50971d
+1 -1
View File
@@ -1023,6 +1023,7 @@ func (l *Loader) startSubcontainer(spec *specs.Spec, conf *config.Config, cid st
}
containerName := l.registerContainerLocked(spec, cid)
l.k.RegisterContainerName(cid, containerName)
info := &containerInfo{
cid: cid,
containerName: containerName,
@@ -1091,7 +1092,6 @@ func (l *Loader) startSubcontainer(spec *specs.Spec, conf *config.Config, cid st
})
}
l.k.RegisterContainerName(cid, info.containerName)
l.k.StartProcess(ep.tg)
// No more failures from this point on.
cu.Release()