mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 09:55:44 +03:00
Merge pull request #6 from hashicorp/cpu-resources
populate CPU in Node Resources
This commit is contained in:
@@ -52,7 +52,14 @@ func (f *CPUFingerprint) Fingerprint(cfg *config.Config, node *structs.Node) (bo
|
||||
}
|
||||
|
||||
if mhz > 0 && numCores > 0 {
|
||||
node.Attributes["cpu.totalcompute"] = fmt.Sprintf("%.6f", float64(numCores)*mhz)
|
||||
tc := float64(numCores) * mhz
|
||||
node.Attributes["cpu.totalcompute"] = fmt.Sprintf("%.6f", tc)
|
||||
|
||||
if node.Resources == nil {
|
||||
node.Resources = &structs.Resources{}
|
||||
}
|
||||
|
||||
node.Resources.CPU = tc
|
||||
}
|
||||
|
||||
if modelName != "" {
|
||||
|
||||
@@ -35,4 +35,8 @@ func TestCPUFingerprint(t *testing.T) {
|
||||
t.Fatalf("Missing CPU Total Compute")
|
||||
}
|
||||
|
||||
if node.Resources == nil {
|
||||
t.Fatalf("Expected resources on node, but got nil")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user