mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
Improve error message in cpu assignment logic
Include number of requested and available CPUs in the error message when the assignment of CPUs fails because there are less available CPUs than requested.
This commit is contained in:
parent
246aba8912
commit
d4a5a085a8
@ -453,7 +453,7 @@ func takeByTopologyNUMAPacked(topo *topology.CPUTopology, availableCPUs cpuset.C
|
||||
return acc.result, nil
|
||||
}
|
||||
if acc.isFailed() {
|
||||
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request")
|
||||
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request: requested=%d, available=%d", numCPUs, availableCPUs.Size())
|
||||
}
|
||||
|
||||
// Algorithm: topology-aware best-fit
|
||||
@ -565,7 +565,7 @@ func takeByTopologyNUMADistributed(topo *topology.CPUTopology, availableCPUs cpu
|
||||
return acc.result, nil
|
||||
}
|
||||
if acc.isFailed() {
|
||||
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request")
|
||||
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request: requested=%d, available=%d", numCPUs, availableCPUs.Size())
|
||||
}
|
||||
|
||||
// Get the list of NUMA nodes represented by the set of CPUs in 'availableCPUs'.
|
||||
|
@ -522,7 +522,7 @@ func commonTakeByTopologyTestCases(t *testing.T) []takeByTopologyTestCase {
|
||||
topoSingleSocketHT,
|
||||
cpuset.New(0, 2, 4, 6),
|
||||
5,
|
||||
"not enough cpus available to satisfy request",
|
||||
"not enough cpus available to satisfy request: requested=5, available=4",
|
||||
cpuset.New(),
|
||||
},
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
||||
stAssignments: state.ContainerCPUAssignments{},
|
||||
stDefaultCPUSet: cpuset.New(0, 1, 2, 3, 4, 5, 6, 7),
|
||||
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=8, available=7"),
|
||||
expCPUAlloc: false,
|
||||
expCSet: cpuset.New(),
|
||||
},
|
||||
@ -429,7 +429,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
||||
},
|
||||
stDefaultCPUSet: cpuset.New(0, 4, 5, 6, 7, 8, 9, 10, 11),
|
||||
pod: makePod("fakePod", "fakeContainer5", "10000m", "10000m"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=10, available=8"),
|
||||
expCPUAlloc: false,
|
||||
expCSet: cpuset.New(),
|
||||
},
|
||||
@ -444,7 +444,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
||||
},
|
||||
stDefaultCPUSet: cpuset.New(0, 7),
|
||||
pod: makePod("fakePod", "fakeContainer5", "2000m", "2000m"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=2, available=1"),
|
||||
expCPUAlloc: false,
|
||||
expCSet: cpuset.New(),
|
||||
},
|
||||
@ -461,7 +461,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
||||
},
|
||||
stDefaultCPUSet: cpuset.New(10, 11, 53, 37, 55, 67, 52),
|
||||
pod: makePod("fakePod", "fakeContainer5", "76000m", "76000m"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=76, available=7"),
|
||||
expCPUAlloc: false,
|
||||
expCSet: cpuset.New(),
|
||||
},
|
||||
@ -981,7 +981,7 @@ func TestStaticPolicyAddWithResvList(t *testing.T) {
|
||||
stAssignments: state.ContainerCPUAssignments{},
|
||||
stDefaultCPUSet: cpuset.New(0, 1, 2, 3, 4, 5, 6, 7),
|
||||
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
||||
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=8, available=7"),
|
||||
expCPUAlloc: false,
|
||||
expCSet: cpuset.New(),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user