File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,11 @@ func (p *staticPolicy) validateState(s state.State) error {
154
154
// topology that was received during CPU manager startup matches with
155
155
// the set of CPUs stored in the state.
156
156
totalKnownCPUs := tmpDefaultCPUset .Clone ()
157
+ tmpCPUSets := []cpuset.CPUSet {}
157
158
for _ , cset := range tmpAssignments {
158
- totalKnownCPUs = totalKnownCPUs . Union ( cset )
159
+ tmpCPUSets = append ( tmpCPUSets , cset )
159
160
}
161
+ totalKnownCPUs = totalKnownCPUs .UnionAll (tmpCPUSets )
160
162
if ! totalKnownCPUs .Equals (p .topology .CPUDetails .CPUs ()) {
161
163
return fmt .Errorf ("current set of available CPUs \" %s\" doesn't match with CPUs in state \" %s\" " ,
162
164
p .topology .CPUDetails .CPUs ().String (), totalKnownCPUs .String ())
Original file line number Diff line number Diff line change @@ -147,6 +147,22 @@ func (s CPUSet) Union(s2 CPUSet) CPUSet {
147
147
return b .Result ()
148
148
}
149
149
150
+ // UnionAll returns a new CPU set that contains all of the elements from this
151
+ // set and all of the elements from the supplied sets, without mutating
152
+ // either source set.
153
+ func (s CPUSet ) UnionAll (s2 []CPUSet ) CPUSet {
154
+ b := NewBuilder ()
155
+ for cpu := range s .elems {
156
+ b .Add (cpu )
157
+ }
158
+ for _ , cs := range s2 {
159
+ for cpu := range cs .elems {
160
+ b .Add (cpu )
161
+ }
162
+ }
163
+ return b .Result ()
164
+ }
165
+
150
166
// Intersection returns a new CPU set that contains all of the elements
151
167
// that are present in both this set and the supplied set, without mutating
152
168
// either source set.
You can’t perform that action at this time.
0 commit comments