mirror of https://github.com/k3s-io/k3s
Elimenate extra CRI call
parent
e1d923a7cb
commit
282973d87d
|
@ -176,11 +176,16 @@ func (m *manager) AddContainer(p *v1.Pod, c *v1.Container, containerID string) e
|
|||
cpus := m.state.GetCPUSetOrDefault(containerID)
|
||||
m.Unlock()
|
||||
|
||||
err = m.updateContainerCPUSet(containerID, cpus)
|
||||
if err != nil {
|
||||
glog.Errorf("[cpumanager] AddContainer error: %v", err)
|
||||
return err
|
||||
if !cpus.IsEmpty() {
|
||||
err = m.updateContainerCPUSet(containerID, cpus)
|
||||
if err != nil {
|
||||
glog.Errorf("[cpumanager] AddContainer error: %v", err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
glog.V(5).Infof("[cpumanager] update container resources is skipped due to cpu set is empty")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ func TestCPUManagerAdd(t *testing.T) {
|
|||
description: "cpu manager add - container update error",
|
||||
regErr: nil,
|
||||
updateErr: fmt.Errorf("fake update error"),
|
||||
expErr: fmt.Errorf("fake update error"),
|
||||
expErr: nil,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue