fix: support stock Sushy emulator without custom root.json - #137
Open
fabiendupont wants to merge 1 commit into
Open
fix: support stock Sushy emulator without custom root.json#137fabiendupont wants to merge 1 commit into
fabiendupont wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new 404-handling guard compares reqwest::StatusCode to an integer literal (404), which will not compile and must be fixed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves compatibility with upstream/stock sushy-tools by making libredfish’s Sushy vendor detection and a couple of vendor-specific behaviors work without requiring a custom root.json template.
Changes:
- Extend
ServiceRootparsing and vendor detection to fall back onId/Namepatterns whenVendor/Oemare missing (stock Sushy behavior). - Make
lockdown_statusreportNotSupportedfor Sushy, aligning with the standard client and avoiding stuck state transitions. - Add Sushy override for
get_software_inventoriesto convert aFirmwareInventory404 intoNotSupported.
File summaries
| File | Description |
|---|---|
| src/sushy.rs | Adjust Sushy vendor behavior for unsupported lockdown status and handle missing FirmwareInventory route gracefully. |
| src/model/service_root.rs | Add Id/Name fields and extend vendor auto-detection logic + tests for stock Sushy roots. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Three issues prevented libredfish from working with stock upstream sushy-tools (tested against stable 2.2.0): 1. Vendor auto-detection failed because stock Sushy has no "Vendor" field in the service root. Add Id and Name fields to ServiceRoot and fall back to detecting "sushy" or "redvirt" in those fields when Vendor and Oem are both absent. 2. lockdown_status returned a fake Ok(Enabled) status, causing callers to get stuck in WAITINGFORLOCKDOWN. Return NotSupported instead, matching the RedfishStandard default for unsupported operations. 3. get_software_inventories hit a raw 404 on stock Sushy (the FirmwareInventory route doesn't exist in stable releases). Convert the 404 to NotSupported so callers get a clean error. When the route exists (e.g. Metal3 dev builds), the standard path is used and works normally. Tested against both the Metal3 dev build (0.0.1.dev405 with custom root.json) and stock stable sushy-tools 2.2.0 from PyPI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fabien Dupont <fdupont@redhat.com> Signed-off-by: Fabien Dupont <fdupont@redhat.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
fabiendupont
force-pushed
the
fix/sushy-stock-compatibility
branch
from
September 3, 2026 08:33
680ed74 to
4aaeeb2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes compatibility with stock upstream sushy-tools (tested against stable 2.2.0 from PyPI). Follow-up to #115.
@s3rj1k reported two issues when running NiCO against vanilla Sushy master:
HTTP 404 Not Foundat/redfish/v1/UpdateService/FirmwareInventory(comment)HOSTINITIALIZING/WAITINGFORLOCKDOWNregardless of admin-cli input (comment)Investigation revealed a third issue: stock Sushy has no
Vendorfield in the service root, so vendor auto-detection fails entirely — libredfish falls back to the genericRedfishStandardclient instead of the Sushy vendor implementation.Root causes and fixes
1. Vendor auto-detection (
service_root.rs)Stock Sushy 2.2.0 has no
VendororOemfields in the service root JSON, but uses"Id": "RedvirtService"and"Name": "Redvirt Service". Addedidandnamefields toServiceRootand extendedvendor_string()with a third fallback that detects "sushy" or "redvirt" in those fields.Previously, without a custom
root.jsontemplate that injects"Vendor": "Sushy", libredfish resolved the vendor asUnknownand used the generic standard client — none of the Sushy-specific stubs applied.2.
lockdown_statusstuck in WAITINGFORLOCKDOWN (sushy.rs)The Sushy vendor returned
Ok(Status::Enabled)forlockdown_status, faking a successful lockdown. Callers then believed the machine was locked down and waited for a state transition that could never happen. Changed to returnErr(RedfishError::NotSupported("lockdown_status")), matching theRedfishStandarddefault for unsupported operations.3.
FirmwareInventory404 (sushy.rs)Stock Sushy 2.2.0 advertises
FirmwareInventoryin theUpdateServiceJSON body but doesn't implement the route handler (added in unreleased dev builds). The standardget_software_inventoriescall hits a raw 404. Added an override that tries the standard path first and converts a 404 intoNotSupported. When the route exists (e.g. Metal3 dev builds with the controller), it works normally.Test plan
🤖 Generated with Claude Code