Skip to content

fix: bug in containment name for node #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/akamensky/argparse v1.4.0
github.com/converged-computing/jsongraph-go v0.0.0-20240225004212-223ddffb7565
github.com/converged-computing/jsongraph-go v0.0.0-20240229082022-c6887a5a00fe
github.com/converged-computing/nfd-source v0.0.0-20240224025007-20d686e64926
github.com/jedib0t/go-pretty/v6 v6.5.4
github.com/moby/moby v25.0.3+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/akamensky/argparse v1.4.0 h1:YGzvsTqCvbEZhL8zZu2AiA5nq805NZh75JNj4ajn
github.com/akamensky/argparse v1.4.0/go.mod h1:S5kwC7IuDcEr5VeXtGPRVZ5o/FdhcMlQz4IZQuw64xA=
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/converged-computing/jsongraph-go v0.0.0-20240225004212-223ddffb7565 h1:ZwJngPrF1yvM4ZGEyoT1b8h5e0qUumOxeDZLN37pPTk=
github.com/converged-computing/jsongraph-go v0.0.0-20240225004212-223ddffb7565/go.mod h1:+DhVyLXGVfBsfta4185jd33jqa94inshCcdvsXK2Irk=
github.com/converged-computing/jsongraph-go v0.0.0-20240229082022-c6887a5a00fe h1:Tk//RW3uKn4A7N8gpHRXs+ZGlR7Fxkwh+4/Iml0GBV4=
github.com/converged-computing/jsongraph-go v0.0.0-20240229082022-c6887a5a00fe/go.mod h1:+DhVyLXGVfBsfta4185jd33jqa94inshCcdvsXK2Irk=
github.com/converged-computing/nfd-source v0.0.0-20240224025007-20d686e64926 h1:VZmgK3t4564vdHNpE//q6kuPlugOrojkDHP4Gqd4A1g=
github.com/converged-computing/nfd-source v0.0.0-20240224025007-20d686e64926/go.mod h1:I15nBsQqBTUsc3A4a6cuQmZjQ8lYUZSZ2a7UAE5SZ3g=
github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=
Expand Down
2 changes: 1 addition & 1 deletion pkg/graph/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (c *ClusterGraph) getNode(

// The resource name is the type + the resource counter
// path should be assembled from parents up to this node
resourceName := fmt.Sprintf("%s/%s%d", path, name, counter)
resourceName := fmt.Sprintf("%s/%s", path, nameWithCount)

// New Metadata with expected fluxion data
m := metadata.Metadata{}
Expand Down
22 changes: 19 additions & 3 deletions plugins/creators/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ func (c ClusterCreator) Create(options plugin.PluginOptions) error {
// First add the rack -> node
// We only have one rack here, so hard coded id for now
node := *g.AddNode("node", "node", 1, false, "", "rack0")
nodeName, err := node.Metadata.GetStringElement("name")

// This should not happen, we just added it!
if err != nil {
fmt.Printf("node %s cannot derive name, skipping\n", nodeFile)
continue
}

g.AddEdge(rack, node, "contains")
g.AddEdge(node, rack, "in")

Expand Down Expand Up @@ -181,14 +189,22 @@ func (c ClusterCreator) Create(options plugin.PluginOptions) error {

// Create each socket attached to the node
// rack -> node -> socket
path := fmt.Sprintf("rack0/node%s", *node.Label)
path := fmt.Sprintf("rack0/%s", nodeName)
socketNode := *g.AddNode("socket", "socket", 1, false, "", path)
socketName, err := socketNode.Metadata.GetStringElement("name")

// This also is not going to happen
if err != nil {
fmt.Printf("socket %x cannot derive name, skipping\n", socketNode)
continue
}

g.AddEdge(node, socketNode, "contains")
g.AddEdge(socketNode, node, "in")

// Create each core attached to the socket
for _, _ = range chunk {
path := fmt.Sprintf("rack0/node%s/socket%s", *node.Label, *socketNode.Label)
for range chunk {
path := fmt.Sprintf("rack0/%s/%s", nodeName, socketName)
coreNode := *g.AddNode("core", "core", 1, false, "", path)
g.AddEdge(socketNode, coreNode, "contains")
g.AddEdge(coreNode, socketNode, "in")
Expand Down