Skip to content
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

CASMHMS-6073 #119

Closed
wants to merge 3 commits into from
Closed
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
11 changes: 6 additions & 5 deletions cmd/smd-loader/smd-loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ package main
import (
"context"
"fmt"
"github.com/hashicorp/go-retryablehttp"
"io/ioutil"
"net/http"
"os"
"os/signal"
"github.com/Cray-HPE/hms-base"
hmshttp "github.com/Cray-HPE/hms-go-http-lib"
"syscall"
"time"

base "github.com/Cray-HPE/hms-base/v2"
hmshttp "github.com/Cray-HPE/hms-go-http-lib"
"github.com/hashicorp/go-retryablehttp"
)

var ctx context.Context
Expand Down Expand Up @@ -127,8 +128,8 @@ func main() {
CustomHeaders: make(map[string]string),
}

svcName,serr := base.GetServiceInstanceName()
if (serr != nil) {
svcName, serr := base.GetServiceInstanceName()
if serr != nil {
svcName = "SMD-LOADER"
}

Expand Down
27 changes: 14 additions & 13 deletions cmd/smd/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
"fmt"
"strconv"

base "github.com/Cray-HPE/hms-base"
base "github.com/Cray-HPE/hms-base/v2"
"github.com/Cray-HPE/hms-smd/v2/internal/hmsds"
rf "github.com/Cray-HPE/hms-smd/v2/pkg/redfish"
"github.com/Cray-HPE/hms-xname/xnametypes"
)

////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -99,16 +100,16 @@ func (s *SmD) DiscoverComponentChassis(chEP *rf.EpChassis) *base.Component {
comp.Class = chEP.DefaultClass

if comp.Class == "" {
if comp.Type == base.Chassis.String() {
if comp.Type == xnametypes.Chassis.String() {
comp.Class = base.ClassMountain.String()
// Just incase our redfish endpoint didn't exist when our child
// components were discovered, update them to be Mountain too.
f := hmsds.ComponentFilter{
Type: []string{
base.NodeBMC.String(),
base.NodeEnclosure.String(),
base.Node.String(),
base.RouterBMC.String(),
xnametypes.NodeBMC.String(),
xnametypes.NodeEnclosure.String(),
xnametypes.Node.String(),
xnametypes.RouterBMC.String(),
},
}
children, err := s.db.GetComponentsQuery(&f, hmsds.FLTR_ID_ONLY, []string{comp.ID})
Expand All @@ -131,12 +132,12 @@ func (s *SmD) DiscoverComponentChassis(chEP *rf.EpChassis) *base.Component {
// Chassis first then go down a level to the chassisBMC
p := comp.ID
for {
p = base.GetHMSCompParent(p)
p = xnametypes.GetHMSCompParent(p)
if p == "" {
s.LogAlways("DiscoverComponentChassis: Could not determine ChassisBMC ID for %s", comp.ID)
break
}
if base.GetHMSType(p) != base.Chassis {
if xnametypes.GetHMSType(p) != xnametypes.Chassis {
continue
}
chassisBmc := p + "b0"
Expand Down Expand Up @@ -194,12 +195,12 @@ func (s *SmD) DiscoverComponentSystem(sysEP *rf.EpSystem) *base.Component {
// Chassis first then go down a level to the chassisBMC
p := comp.ID
for {
p = base.GetHMSCompParent(p)
p = xnametypes.GetHMSCompParent(p)
if p == "" {
s.LogAlways("DiscoverComponentChassis: Could not determine ChassisBMC ID for %s", comp.ID)
break
}
if base.GetHMSType(p) != base.Chassis {
if xnametypes.GetHMSType(p) != xnametypes.Chassis {
continue
}
chassisBmc := p + "b0"
Expand Down Expand Up @@ -246,19 +247,19 @@ func (s *SmD) DiscoverComponentManager(mEP *rf.EpManager) *base.Component {
comp.Class = mEP.DefaultClass

if comp.Class == "" {
if comp.Type == base.ChassisBMC.String() {
if comp.Type == xnametypes.ChassisBMC.String() {
comp.Class = base.ClassMountain.String()
} else {
// Get the ID for the parent Chassis BMC. Need to find the
// Chassis first then go down a level to the chassisBMC
p := comp.ID
for {
p = base.GetHMSCompParent(p)
p = xnametypes.GetHMSCompParent(p)
if p == "" {
s.LogAlways("DiscoverComponentChassis: Could not determine ChassisBMC ID for %s", comp.ID)
break
}
if base.GetHMSType(p) != base.Chassis {
if xnametypes.GetHMSType(p) != xnametypes.Chassis {
continue
}
chassisBmc := p + "b0"
Expand Down
Loading
Loading