diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index a4498b9dc6..2c22cc50df 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -4274,9 +4274,14 @@ func (hh *SHost) PerformReserveCpus( return nil, err } - if !sets.NewInt(allCores...).HasAll(cs.ToSlice()...) { + hSets := sets.NewInt(allCores...) + cSlice := cs.ToSlice() + if !hSets.HasAll(cSlice...) { return nil, httperrors.NewInputParameterError("Host cores not contains input %v", input.Cpus) } + if hSets.Len() == len(cSlice) { + return nil, httperrors.NewInputParameterError("Can't reserve host all cpus") + } if input.Mems != "" { mems, err := cpuset.Parse(input.Mems)