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.
* 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.
* 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 ¶
- Variables
- type DeltaUpgradeRule
- type FirmwareEntry
- type FirmwareFetcher
- type FirmwareRepo
- type FirmwareUpdateRecord
- type FirmwareUpdateStore
- type FirmwareUpdater
- type FirmwareUpgrade
- type InMemoryStore
- func (s *InMemoryStore) CreateOrReplace(_ context.Context, mac net.HardwareAddr, component powershelf.Component, ...) (*FirmwareUpdateRecord, error)
- func (s *InMemoryStore) Get(_ context.Context, mac net.HardwareAddr, component powershelf.Component) (*FirmwareUpdateRecord, error)
- func (s *InMemoryStore) GetAllPending(_ context.Context) ([]*FirmwareUpdateRecord, error)
- func (s *InMemoryStore) SetState(_ context.Context, mac net.HardwareAddr, component powershelf.Component, ...) error
- func (s *InMemoryStore) Start(context.Context) error
- func (s *InMemoryStore) Stop(context.Context) error
- type LiteonUpgradeRule
- type Manager
- func (manager *Manager) CanUpdate(ctx context.Context, pmc *pmc.PMC, component powershelf.Component, ...) (bool, error)
- func (manager *Manager) GetFirmwareUpdate(ctx context.Context, mac net.HardwareAddr, component powershelf.Component) (*powershelf.FirmwareUpdate, error)
- func (manager *Manager) ListAvailableFirmware(ctx context.Context, pmc *pmc.PMC) ([]FirmwareUpgrade, error)
- func (manager *Manager) SetDryRun(dryRun bool)
- func (manager *Manager) SetUpdateState(ctx context.Context, rec *FirmwareUpdateRecord, ...) error
- func (manager *Manager) Summary() (string, error)
- func (manager *Manager) Upgrade(ctx context.Context, pmc *pmc.PMC, component powershelf.Component, ...) error
- type PostgresStore
- func (ps *PostgresStore) CreateOrReplace(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, ...) (*FirmwareUpdateRecord, error)
- func (ps *PostgresStore) Get(ctx context.Context, mac net.HardwareAddr, component powershelf.Component) (*FirmwareUpdateRecord, error)
- func (ps *PostgresStore) GetAllPending(ctx context.Context) ([]*FirmwareUpdateRecord, error)
- func (ps *PostgresStore) SetState(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, ...) error
- func (ps *PostgresStore) Start(ctx context.Context) error
- func (ps *PostgresStore) Stop(ctx context.Context) error
- type UpgradeRule
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("firmware update not found")
ErrNotFound is returned by Get when no firmware update record exists for the requested (mac, component) key.
Functions ¶
This section is empty.
Types ¶
type DeltaUpgradeRule ¶ added in v1.3.1
type DeltaUpgradeRule struct{}
DeltaUpgradeRule allows only direct upgrades where the device's current version equals the edge's source.
type FirmwareEntry ¶
type FirmwareEntry struct {
// contains filtered or unexported fields
}
FirmwareEntry identifies a firmware artifact by name and FS path.
type FirmwareFetcher ¶
type FirmwareFetcher struct {
// contains filtered or unexported fields
}
FirmwareFetcher provides read-only access to firmware assets organized as firmware/<vendor>/pmc.
type FirmwareRepo ¶
type FirmwareRepo struct {
// contains filtered or unexported fields
}
FirmwareRepo holds parsed firmware upgrade edges and the supported starting-version range for a vendor.
type FirmwareUpdateRecord ¶ added in v1.2.0
type FirmwareUpdateRecord struct {
PmcMacAddress net.HardwareAddr
Component powershelf.Component
VersionFrom string
VersionTo string
State powershelf.FirmwareState
JobID string
ErrorMessage string
LastTransitionTime time.Time
UpdatedAt time.Time
}
FirmwareUpdateRecord is a storage-agnostic representation of a firmware update used by the Manager. Both the Postgres and in-memory backends produce this type.
func (*FirmwareUpdateRecord) IsTerminal ¶ added in v1.2.0
func (r *FirmwareUpdateRecord) IsTerminal() bool
IsTerminal returns true if the firmware update is in a terminal state.
type FirmwareUpdateStore ¶ added in v1.2.0
type FirmwareUpdateStore interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
// CreateOrReplace upserts a firmware update keyed by (mac, component).
CreateOrReplace(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, versionFrom, versionTo string) (*FirmwareUpdateRecord, error)
// Get retrieves the firmware update for (mac, component).
// Returns ErrNotFound if no record exists.
Get(ctx context.Context, mac net.HardwareAddr, component powershelf.Component) (*FirmwareUpdateRecord, error)
// GetAllPending returns all non-terminal firmware updates.
GetAllPending(ctx context.Context) ([]*FirmwareUpdateRecord, error)
// SetState transitions a record to a new state with an optional error message.
SetState(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, newState powershelf.FirmwareState, errMsg string) error
}
FirmwareUpdateStore abstracts firmware update persistence so the Manager can operate against either a Postgres-backed or in-memory backend.
type FirmwareUpdater ¶
type FirmwareUpdater struct {
// contains filtered or unexported fields
}
FirmwareUpdater encapsulates a vendor's FirmwareRepo and UpgradeRule to select and execute upgrades.
func (*FirmwareUpdater) Summary ¶
func (updater *FirmwareUpdater) Summary() (string, error)
Summary returns the repo and rule summaries for the vendor.
type FirmwareUpgrade ¶
type FirmwareUpgrade struct {
// contains filtered or unexported fields
}
FirmwareUpgrade represents a single directed edge from a source firmware version to a target version, with the artifact path.
func (*FirmwareUpgrade) UpgradeTo ¶
func (upgrade *FirmwareUpgrade) UpgradeTo() firmwareVersion
type InMemoryStore ¶ added in v1.2.0
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is an in-memory implementation of FirmwareUpdateStore. All data is lost when the process exits.
func NewInMemoryStore ¶ added in v1.2.0
func NewInMemoryStore() *InMemoryStore
func (*InMemoryStore) CreateOrReplace ¶ added in v1.2.0
func (s *InMemoryStore) CreateOrReplace(_ context.Context, mac net.HardwareAddr, component powershelf.Component, versionFrom, versionTo string) (*FirmwareUpdateRecord, error)
func (*InMemoryStore) Get ¶ added in v1.2.0
func (s *InMemoryStore) Get(_ context.Context, mac net.HardwareAddr, component powershelf.Component) (*FirmwareUpdateRecord, error)
func (*InMemoryStore) GetAllPending ¶ added in v1.2.0
func (s *InMemoryStore) GetAllPending(_ context.Context) ([]*FirmwareUpdateRecord, error)
func (*InMemoryStore) SetState ¶ added in v1.2.0
func (s *InMemoryStore) SetState(_ context.Context, mac net.HardwareAddr, component powershelf.Component, newState powershelf.FirmwareState, errMsg string) error
type LiteonUpgradeRule ¶
type LiteonUpgradeRule struct{}
LiteonUpgradeRule allows upgrades where the device's current version equals the edge's source or target. Liteon firmware artifacts are full images, so re-flashing the same version (current == to) is safe.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager aggregates per-vendor FirmwareUpdater instances and exposes a vendor-agnostic API for firmware operations.
func New ¶
func New(store FirmwareUpdateStore, pmcManager *pmcmanager.PmcManager, dryRun bool, firmwareDir string) (*Manager, error)
New constructs a Manager with the given FirmwareUpdateStore backend. firmwareDir specifies the on-disk directory containing firmware artifacts (env: FW_DIR).
func (*Manager) CanUpdate ¶
func (manager *Manager) CanUpdate(ctx context.Context, pmc *pmc.PMC, component powershelf.Component, targetVersion string) (bool, error)
CanUpdate returns whether a PMC's current firmware is within the supported range.
func (*Manager) GetFirmwareUpdate ¶
func (manager *Manager) GetFirmwareUpdate(ctx context.Context, mac net.HardwareAddr, component powershelf.Component) (*powershelf.FirmwareUpdate, error)
GetFirmwareUpdate returns the status of a firmware update for the specified PMC MAC and component.
func (*Manager) ListAvailableFirmware ¶
func (manager *Manager) ListAvailableFirmware(ctx context.Context, pmc *pmc.PMC) ([]FirmwareUpgrade, error)
ListAvailableFirmware returns the available firmware upgrades for a PMC.
func (*Manager) SetUpdateState ¶
func (manager *Manager) SetUpdateState(ctx context.Context, rec *FirmwareUpdateRecord, newState powershelf.FirmwareState, errMsg string) error
type PostgresStore ¶ added in v1.2.0
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore is a Postgres-backed implementation of FirmwareUpdateStore.
func NewPostgresStore ¶ added in v1.2.0
NewPostgresStore initializes connectivity to Postgres and runs any pending migrations.
func (*PostgresStore) CreateOrReplace ¶ added in v1.2.0
func (ps *PostgresStore) CreateOrReplace(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, versionFrom, versionTo string) (*FirmwareUpdateRecord, error)
func (*PostgresStore) Get ¶ added in v1.2.0
func (ps *PostgresStore) Get(ctx context.Context, mac net.HardwareAddr, component powershelf.Component) (*FirmwareUpdateRecord, error)
func (*PostgresStore) GetAllPending ¶ added in v1.2.0
func (ps *PostgresStore) GetAllPending(ctx context.Context) ([]*FirmwareUpdateRecord, error)
func (*PostgresStore) SetState ¶ added in v1.2.0
func (ps *PostgresStore) SetState(ctx context.Context, mac net.HardwareAddr, component powershelf.Component, newState powershelf.FirmwareState, errMsg string) error
type UpgradeRule ¶
type UpgradeRule interface {
// contains filtered or unexported methods
}
UpgradeRule determines whether a given upgrade edge is permissible from a current firmware version.