Documentation
¶
Overview ¶
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- func DeleteFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, ...) error
- func SetFirmwareUpdateState(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, ...) error
- type FirmwareUpdate
- func GetAllPendingFirmwareUpdates(ctx context.Context, db bun.IDB) ([]FirmwareUpdate, error)
- func GetFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, ...) (*FirmwareUpdate, error)
- func ListFirmwareUpdatesForPMC(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, ...) ([]FirmwareUpdate, error)
- func NewFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, ...) (*FirmwareUpdate, error)
- func (fu *FirmwareUpdate) Create(ctx context.Context, tx bun.Tx) error
- func (fu *FirmwareUpdate) Get(ctx context.Context, idb bun.IDB) (*FirmwareUpdate, error)
- func (fu *FirmwareUpdate) IsTerminal() bool
- func (fu *FirmwareUpdate) SetJobID(ctx context.Context, db bun.IDB, jobID string) error
- func (fu *FirmwareUpdate) SetVersionTarget(ctx context.Context, db bun.IDB, vTarget string) error
- func (fu *FirmwareUpdate) UpdateFirmwareUpdateState(ctx context.Context, db bun.IDB, newState powershelf.FirmwareState, ...) error
- type IPAddr
- type MacAddr
- type PMC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteFirmwareUpdate ¶
func DeleteFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, comp powershelf.Component) error
DeleteFirmwareUpdate deletes a FirmwareUpdate by composite PK.
func SetFirmwareUpdateState ¶ added in v1.2.0
func SetFirmwareUpdateState(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, comp powershelf.Component, newState powershelf.FirmwareState, errMsg string) error
SetFirmwareUpdateState transitions a firmware update identified by (pmcMac, comp) to newState with an optional error message in a single UPDATE (no prior SELECT).
Types ¶
type FirmwareUpdate ¶
type FirmwareUpdate struct {
bun.BaseModel `bun:"table:firmware_update,alias:fu"`
PmcMacAddress MacAddr `bun:"pmc_mac_address,pk,notnull,type:macaddr"` // MAC address of the target PMC (FK to pmc.mac_address)
Component powershelf.Component `bun:"component,pk,notnull"` // Component being updated (e.g., "PMC", "PSU1")
VersionFrom string `bun:"version_from,notnull"` // Firmware version before upgrade
VersionTo string `bun:"version_to,notnull"` // Target firmware version after upgrade
State powershelf.FirmwareState `bun:"state,notnull"` // Upgrade state ("Queued", "Updating", "Completed", "Failed", etc.)
LastTransitionTime time.Time `bun:"last_transition_time,notnull"` // When the state last changed
JobID string `bun:"job_id"` // Device job/task ID, if provided by hardware
ErrorMessage string `bun:"error_message"` // Error message if the upgrade failed
CreatedAt time.Time `bun:"created_at,notnull,default:now()"` // When this record was created
UpdatedAt time.Time `bun:"updated_at,notnull,default:now()"` // When this record was last updated
}
FirmwareUpdate represents the latest firmware update operation for a specific component of a PMC (Power Management Controller). The composite primary key is (PmcMacAddress, Component).
func GetAllPendingFirmwareUpdates ¶
GetAllPendingFirmwareUpdates lists all non-terminal firmware updates across all PMCs
func GetFirmwareUpdate ¶
func GetFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, comp powershelf.Component) (*FirmwareUpdate, error)
GetFirmwareUpdate fetches a FirmwareUpdate by composite PK (pmcMac, comp).
func ListFirmwareUpdatesForPMC ¶
func ListFirmwareUpdatesForPMC(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, comp *powershelf.Component) ([]FirmwareUpdate, error)
ListFirmwareUpdatesForPMC lists all firmware updates for a given PMC (optionally filter by component).
func NewFirmwareUpdate ¶
func NewFirmwareUpdate(ctx context.Context, db bun.IDB, pmcMac net.HardwareAddr, comp powershelf.Component, vStart, vTarget string) (*FirmwareUpdate, error)
NewFirmwareUpdate creates and inserts (or upserts) a FirmwareUpdate record using the composite PK. If a record already exists for (pmcMac, comp), it will be replaced.
func (*FirmwareUpdate) Get ¶
func (fu *FirmwareUpdate) Get( ctx context.Context, idb bun.IDB, ) (*FirmwareUpdate, error)
Get retrieves a FirmwareUpdate by MAC and component (both must be specified).
func (*FirmwareUpdate) IsTerminal ¶
func (fu *FirmwareUpdate) IsTerminal() bool
IsTerminal returns true if the firmware update is in a terminal state.
func (*FirmwareUpdate) SetVersionTarget ¶
SetVersionTarget sets the target version for a FirmwareUpdate and persists it.
func (*FirmwareUpdate) UpdateFirmwareUpdateState ¶
func (fu *FirmwareUpdate) UpdateFirmwareUpdateState(ctx context.Context, db bun.IDB, newState powershelf.FirmwareState, errMsg string) error
UpdateFirmwareUpdateState sets the state and optional error message for a FirmwareUpdate. Only updates LastTransitionTime if the state actually changes.
type IPAddr ¶
IPAddr wraps net.IP to provide proper SQL driver support for PostgreSQL inet type.
type MacAddr ¶
type MacAddr net.HardwareAddr
MacAddr wraps net.HardwareAddr to provide proper SQL driver support for PostgreSQL macaddr type.
func (MacAddr) HardwareAddr ¶
func (m MacAddr) HardwareAddr() net.HardwareAddr
HardwareAddr returns the underlying net.HardwareAddr.
func (*MacAddr) Scan ¶
Scan implements sql.Scanner for MacAddr. Handles both string and []byte inputs from PostgreSQL.
type PMC ¶
type PMC struct {
bun.BaseModel `bun:"table:pmc,alias:p"`
MacAddress MacAddr `bun:"mac_address,pk,unique,notnull,type:macaddr"`
Vendor vendor.VendorCode `bun:"vendor,notnull"`
IPAddress IPAddr `bun:"ip_address,unique,notnull,type:inet"`
}
PMC is the database model for a power shelf PMC with unique MAC and IP and a vendor code.
func (*PMC) BuildPatch ¶
BuildPatch copies changed patchable fields from cur; returns nil if no changes.
func (*PMC) InvalidType ¶
InvalidType returns true if the PMC's vendor code is unsupported.