On-Demand Rack Maintenance
On-demand maintenance allows an operator to trigger a maintenance cycle on a rack that is in the Ready or Error state. It supports both full-rack and partial-rack scoping — the caller can optionally specify which machines, switches, or power shelves to maintain, and which maintenance activities to perform.
Scope: Full Rack vs Partial Rack
The maintenance request carries an optional MaintenanceScope that specifies which devices to include:
When no device IDs are specified (all three lists empty), the scope is treated as full rack — identical to the existing reprovision_requested behavior.
Activities
The request also carries an optional list of maintenance activities to perform. When the list is empty, all non-power activities are selected. On-demand compute-host reboots require an explicit PowerSequence activity. Available activities:
Each activity is represented as a MaintenanceActivityConfig message with a oneof activity field. The oneof discriminant identifies the activity type, and each variant carries only the configuration fields relevant to that activity.
Selected activities execute in firmware upgrade, NVOS update, power sequence, then NMX-C configuration order, regardless of request ordering. An on-demand NVOS update alone does not reboot compute hosts. See the rack maintenance flow for ingestion, reboot completion, and resume behavior.
Firmware Configuration Source
The update configuration depends on how maintenance was requested:
Explicit update activities require nonempty, valid JSON; the API rejects missing or invalid JSON. Despite its name, firmware_version carries SOT JSON, not a firmware record ID. Omitted or empty access tokens are passed to RMS as NOAUTH.
Without a configured rack-profile firmware object, implicit update phases are skipped. NVOS update instead enters Error if a scoped switch is already waiting for that update. See the rack maintenance flow for details.
Flow
- The caller invokes the
OnDemandRackMaintenancegRPC method with arack_idand optional device-ID lists. - The handler validates that the rack is in
ReadyorErrorstate and no maintenance is already pending. - It writes a
MaintenanceScopetoRackConfig.maintenance_requestedand persists the config. - On the next state-handler tick,
handle_readyorhandle_errordetectsmaintenance_requestedand enters the first selected maintenance activity. - Update activities use the configuration source described above and filter device reprovisioning and firmware-upgrade operations to the scope. An explicitly selected power sequence gracefully reboots all rack compute hosts, regardless of device scope.
- After maintenance completes, the rack flows through
Validatingback toReadyas usual.
gRPC API
Service method (in NICo service):
Messages:
Component Manager Integration
The UpdateComponentFirmware gRPC endpoint provides a higher-level interface for firmware updates. For compute trays and switches, it delegates to the rack state machine by internally calling on_demand_rack_maintenance, rather than managing firmware directly.
How it works
When update_component_firmware receives a request targeting compute trays or switches:
- Resolve the rack — looks up the first device (machine or switch) in the database to find its
rack_id. - Build a maintenance request — constructs a
RackMaintenanceOnDemandRequestwith:- The resolved
rack_id - The machine IDs and/or switch IDs from the request
- A
FirmwareUpgradeactivity carrying thetarget_versionasfirmware_version
- The resolved
- Delegate — calls
on_demand_rack_maintenance, which writes theMaintenanceScopeto the rack config and lets the rack state machine handle the actual firmware upgrade. - Return success — once the maintenance is scheduled, returns a success
ComponentResultfor each device.
Power shelves continue to use the component manager backend directly (they do not go through the rack state machine).
Example: compute tray firmware upgrade
- The caller sends
UpdateComponentFirmwarewithComputeTrays { machine_ids: [machine-001, machine-002] }and the SOT JSON object encoded intarget_version. - Machine
machine-001is looked up to discoverrack_id = rack-42. OnDemandRackMaintenanceis called withrack_id = rack-42,machine_ids = [machine-001, machine-002], and aFirmwareUpgradeActivitycarrying that same JSON infirmware_version.- The rack state machine runs the firmware upgrade via RMS for the specified machines, using the supplied JSON rather than looking up a firmware record ID.
Preconditions
The gRPC handler rejects the request with an error if:
- The rack is not in
ReadyorErrorstate — maintenance can only be triggered from these two states. - A maintenance request is already pending (
maintenance_requestedis already set). - Any provided device ID is malformed (cannot be parsed).
RBAC
The OnDemandRackMaintenance permission is granted to the NicoAdminCLI role.
Failure Handling
If the maintenance state machine transitions to Error (for example, a
firmware upgrade fails, the requested rack firmware cannot be found, or RMS is
unreachable), the handler clears maintenance_requested while persisting the
Error transition.
This is important because handle_error re-enters Maintenance whenever
maintenance_requested is set; without clearing it, the rack would loop
between Maintenance and Error on the same failing request. The user must
issue a new OnDemandRackMaintenance call to retry.
Restarting a compute stuck in FailedFirmwareUpgrade
A compute tray whose host firmware upgrade fails lands in
M_HostReprovision::FailedFirmwareUpgrade. From there it normally retries
automatically (bounded by MAX_FIRMWARE_UPGRADE_RETRIES and
host_firmware_upgrade_retry_interval).
When an on-demand maintenance call (or, equivalently, the rack maintenance
flow) issues a fresh trigger_host_reprovisioning_request against such a
machine, host_reprovisioning_requested is overwritten with
started_at = None. The FailedFirmwareUpgrade arm in
HostUpgradeState::handle_host_reprovision detects this fresh request
(started_at.is_none()) and:
- For rack-initiated requests (initiator prefixed
rack-), transitions toM_HostReprovision::WaitingForRackFirmwareUpgradeso the rack-level RMS flow can drive the upgrade. - Otherwise transitions to
M_HostReprovision::CheckingFirmwareV2withretry_countreset to0, mirroring the wayManagedHostState::Readykicks off a Host Reprovision (including thehost-fw-updatehealth-report alert merge).
This means an on-demand maintenance call always converges a stuck compute back
toward M_Ready without waiting for the auto-retry interval, which is what
allows the rack to progress out of R_Maintenance into R_Validation.
Ready State Priority
When the rack is in Ready, three config flags are checked in order. The first match wins:
topology_changed→ transition toDiscoveringreprovision_requested→ transition toMaintenance(FirmwareUpgrade/Start)(clears any pendingmaintenance_requested)maintenance_requested→ transition toMaintenance(FirmwareUpgrade/Start)with device scope