File tree Expand file tree Collapse file tree 6 files changed +17
-4
lines changed Expand file tree Collapse file tree 6 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1569,6 +1569,12 @@ func (c *Client) setupNode() error {
1569
1569
node .NodeResources .MinDynamicPort = newConfig .MinDynamicPort
1570
1570
node .NodeResources .MaxDynamicPort = newConfig .MaxDynamicPort
1571
1571
node .NodeResources .Processors = newConfig .Node .NodeResources .Processors
1572
+
1573
+ if node .NodeResources .Processors .Empty () {
1574
+ node .NodeResources .Processors = structs.NodeProcessorResources {
1575
+ Topology : & numalib.Topology {},
1576
+ }
1577
+ }
1572
1578
}
1573
1579
if node .ReservedResources == nil {
1574
1580
node .ReservedResources = & structs.NodeReservedResources {}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ type SystemScanner interface {
18
18
// a single Topology, which can then be used to answer questions about the CPU
19
19
// topology of the system.
20
20
func Scan (scanners []SystemScanner ) * Topology {
21
- top := new ( Topology )
21
+ top := & Topology {}
22
22
for _ , scanner := range scanners {
23
23
scanner .ScanSystem (top )
24
24
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ func (n *NodeResources) Compatibility() {
28
28
// the LegacyNodeCpuResources field, and so we synthesize a pseudo
29
29
// NodeProcessorResources field
30
30
n .Processors .Topology = topologyFromLegacy (n .Cpu )
31
- } else if ! n .Processors .empty () {
31
+ } else if ! n .Processors .Empty () {
32
32
// When we receive a node update from a 1.7+ client it contains a
33
33
// NodeProcessorResources field, and we populate the LegacyNodeCpuResources
34
34
// field using that information.
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ func (n *NodeResources) Compatibility() {
31
31
// the LegacyNodeCpuResources field, and so we synthesize a pseudo
32
32
// NodeProcessorResources field
33
33
n .Processors .Topology = topologyFromLegacy (n .Cpu )
34
- } else if ! n .Processors .empty () {
34
+ } else if ! n .Processors .Empty () {
35
35
// When we receive a node update from a 1.7+ client it contains a
36
36
// NodeProcessorResources field, and we populate the LegacyNodeCpuResources
37
37
// field using that information.
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ type NodeProcessorResources struct {
128
128
129
129
// partial struct serialization / copy / merge sadness means this struct can
130
130
// exist with no data, which is a condition we must detect during the upgrade path
131
- func (r NodeProcessorResources ) empty () bool {
131
+ func (r NodeProcessorResources ) Empty () bool {
132
132
return r .Topology == nil || len (r .Topology .Cores ) == 0
133
133
}
134
134
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import (
36
36
"github.com/hashicorp/go-version"
37
37
"github.com/hashicorp/nomad/acl"
38
38
"github.com/hashicorp/nomad/client/lib/idset"
39
+ "github.com/hashicorp/nomad/client/lib/numalib"
39
40
"github.com/hashicorp/nomad/client/lib/numalib/hw"
40
41
"github.com/hashicorp/nomad/command/agent/host"
41
42
"github.com/hashicorp/nomad/command/agent/pprof"
@@ -2258,6 +2259,12 @@ func (n *Node) Canonicalize() {
2258
2259
n .NodeResources .NodeNetworks = append (n .NodeResources .NodeNetworks , nnr )
2259
2260
}
2260
2261
}
2262
+
2263
+ if n .NodeResources .Processors .Empty () {
2264
+ n .NodeResources .Processors = NodeProcessorResources {
2265
+ Topology : & numalib.Topology {},
2266
+ }
2267
+ }
2261
2268
}
2262
2269
}
2263
2270
You can’t perform that action at this time.
0 commit comments