Skip to content

Commit

Permalink
Report powersupply status
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Oct 1, 2024
1 parent 4c90d33 commit 8cf186c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.23
require (
github.com/gliderlabs/ssh v0.3.7
github.com/kelseyhightower/envconfig v1.4.0
github.com/metal-stack/go-hal v0.5.4
github.com/metal-stack/metal-go v0.35.2
github.com/metal-stack/go-hal v0.5.5-0.20240930121737-4436f2bc9418
github.com/metal-stack/metal-go v0.37.1-0.20241001061321-b6fa718f2176
github.com/metal-stack/v v1.0.3
github.com/nsqio/go-nsq v1.1.0
github.com/stretchr/testify v1.9.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNB
github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/metal-stack/go-hal v0.5.4 h1:lovOdnYtcQnO81xEhmrrFuRonpZEauePTttA3ki0lSw=
github.com/metal-stack/go-hal v0.5.4/go.mod h1:2yeab7N8ApBd44z7mEwWCb+CL7o3ioZu41kSsra50Dw=
github.com/metal-stack/metal-go v0.35.2 h1:brTbmPUiYSH9IdbnCkrcRWFRlIfc0H/53f2phsB+5kY=
github.com/metal-stack/metal-go v0.35.2/go.mod h1:3MJTYCS4YJz8D8oteTKhjpaAKNMMjMKYDrIy9awHGtQ=
github.com/metal-stack/go-hal v0.5.5-0.20240930121737-4436f2bc9418 h1:6/ZxmMCAfsYB1lVDDGxn8w6MMcfdEkDHP/XRA4RpAls=
github.com/metal-stack/go-hal v0.5.5-0.20240930121737-4436f2bc9418/go.mod h1:2yeab7N8ApBd44z7mEwWCb+CL7o3ioZu41kSsra50Dw=
github.com/metal-stack/metal-go v0.37.1-0.20241001061321-b6fa718f2176 h1:QRHcudgrKQtVzyVFlsyjkJO9EQwUM0/dhbOs6PhSNaw=
github.com/metal-stack/metal-go v0.37.1-0.20241001061321-b6fa718f2176/go.mod h1:MQN5ni2Gzu+x2sdk8blbh7elQD1W1vaf0E+RkiV2aoo=
github.com/metal-stack/metal-lib v0.18.3 h1:bovFiJPB9SMvuGLqcXVWz6jFB8HrdzwnCX7TFlen4r0=
github.com/metal-stack/metal-lib v0.18.3/go.mod h1:Ctyi6zaXFr2NVrQZLFsDLnFCzupKnYErTtgRFKAsnbw=
github.com/metal-stack/security v0.8.1 h1:4zmVUxZvDWShVvVIxM3XhIv7pTmPe9DvACRIHW6YTsk=
Expand Down
10 changes: 10 additions & 0 deletions internal/leases/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ func (i *ReportItem) EnrichWithBMCDetails(ipmiPort int, ipmiUser, ipmiPassword s
Minconsumedwatts: &board.PowerMetric.MinConsumedWatts,
}
}
var powerSupplies []*models.V1PowerSupply
for _, ps := range i.PowerSupplies {
powerSupplies = append(powerSupplies, &models.V1PowerSupply{
Status: &models.V1PowerSupplyStatus{
Health: ps.Status.Health,
State: ps.Status.State,
},
})
}
i.PowerSupplies = powerSupplies
}

u, err := ob.UUID()
Expand Down
17 changes: 9 additions & 8 deletions internal/leases/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ type Leases []Lease

type ReportItem struct {
Lease
Log *slog.Logger
UUID *string
BmcVersion *string
BiosVersion *string
FRU *models.V1MachineFru
Powerstate *string
IndicatorLED *string
PowerMetric *models.V1PowerMetric
Log *slog.Logger
UUID *string
BmcVersion *string
BiosVersion *string
FRU *models.V1MachineFru
Powerstate *string
IndicatorLED *string
PowerMetric *models.V1PowerMetric
PowerSupplies []*models.V1PowerSupply
}
1 change: 1 addition & 0 deletions internal/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func (r reporter) report(items []*leases.ReportItem) error {
PowerState: item.Powerstate,
IndicatorLEDState: item.IndicatorLED,
PowerMetric: item.PowerMetric,
PowerSupplies: item.PowerSupplies,
}
reports[*item.UUID] = report
}
Expand Down

0 comments on commit 8cf186c

Please sign in to comment.