Commit f3b98744 authored by tianshapjq's avatar tianshapjq

gpusInUse info error when kubelet restarts

parent 51f3ac1b
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
"os" "os"
"path" "path"
"regexp" "regexp"
"strings"
"sync" "sync"
"github.com/golang/glog" "github.com/golang/glog"
...@@ -101,8 +102,7 @@ func (ngm *nvidiaGPUManager) Start() error { ...@@ -101,8 +102,7 @@ func (ngm *nvidiaGPUManager) Start() error {
if err := ngm.discoverGPUs(); err != nil { if err := ngm.discoverGPUs(); err != nil {
return err return err
} }
// It's possible that the runtime isn't available now.
ngm.allocated = ngm.gpusInUse()
// We ignore errors when identifying allocated GPUs because it is possible that the runtime interfaces may be not be logically up. // We ignore errors when identifying allocated GPUs because it is possible that the runtime interfaces may be not be logically up.
return nil return nil
} }
...@@ -239,7 +239,7 @@ func (ngm *nvidiaGPUManager) gpusInUse() *podGPUs { ...@@ -239,7 +239,7 @@ func (ngm *nvidiaGPUManager) gpusInUse() *podGPUs {
var containersToInspect []containerIdentifier var containersToInspect []containerIdentifier
for _, container := range pod.Status.ContainerStatuses { for _, container := range pod.Status.ContainerStatuses {
if containers.Has(container.Name) { if containers.Has(container.Name) {
containersToInspect = append(containersToInspect, containerIdentifier{container.ContainerID, container.Name}) containersToInspect = append(containersToInspect, containerIdentifier{strings.Replace(container.ContainerID, "docker://", "", 1), container.Name})
} }
} }
// add the pod and its containers that need to be inspected. // add the pod and its containers that need to be inspected.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment