canonical / canonical/hardware-observer-operator

Redfish collector fails with KeyError: 'StorageControllers' when Dell iDRAC exposes a valid Storage resource without that property

Open Beginner friendly
#549 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20
Forks
18
Avg merge
1d 5h
Merged PRs (30d)
3

Description

### Description

hardware-observer reports:

Failure in calling the Redfish API.
```BASH
redfish_call_success = 0
```

Redfish connectivity and authentication are functional. The failure occurs while prometheus-hardware-exporter processes the Dell iDRAC storage collection.

The Dell iDRAC exposes the following Redfish storage members:
```
/redfish/v1/Systems/System.Embedded.1/Storage/CPU.1
/redfish/v1/Systems/System.Embedded.1/Storage/AHCI.SL.6-1
/redfish/v1/Systems/System.Embedded.1/Storage/AHCI.Embedded.1-1
/redfish/v1/Systems/System.Embedded.1/Storage/AHCI.Embedded.2-1
```
Three of the resources contain a StorageControllers property, but /Storage/CPU.1 does not.

CPU.1 is nevertheless a valid Redfish Storage.v1_16_0.Storage object. It exposes 16 drives and reports healthy status:
```
Id: CPU.1
Name: CPU.1
Type: #Storage.v1_16_0.Storage
StorageControllers present: False
StorageControllers: None
Drives count: 16
Health: OK
```
The exporter currently accesses StorageControllers unconditionally:
```Python
storage_controllers_list: List[Dict] = self.redfish_obj.get(
curr_storage_uri
).dict["StorageControllers"]
```
This causes:
```
ERROR Exception occurred while using redfish object: 'StorageControllers'

Traceback (most recent call last):
File ".../prometheus_hardware_exporter/collector.py", line 1036, in fetch
redfish_helper.get_storage_controller_data()
File ".../prometheus_hardware_exporter/collectors/redfish.py", line 306, in get_storage_controller_data
storage_controllers_list: List[Dict] = self.redfish_obj.get(curr_storage_uri).dict[
KeyError: 'StorageControllers'
```

### Charm revision

latest/stable

### Juju version

3.6.13

### Cloud

_No response_

### Expected behaviour

A valid Redfish Storage resource that does not expose a _StorageControllers_ property should not cause the entire Redfish collector to fail.

The collector should handle the property being absent and continue processing the remaining storage resources.

```
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 INFO Response Time for GET to /redfish/v1/Systems/System.Embedded.1/Storage/: 0.03355526924133301 seconds.
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 INFO Attempt 1 of /redfish/v1/Systems/System.Embedded.1/Storage/CPU.1
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 INFO Response Time for GET to /redfish/v1/Systems/System.Embedded.1/Storage/CPU.1: 0.08768933638930321 seconds.
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 ERROR Exception occurred while using redfish object: 'StorageControllers'
Sep 02 18:37:32 dichy0318 python3[2333168]: Traceback (most recent call last):
Sep 02 18:37:32 dichy0318 python3[2333168]: File "/var/lib/juju/agents/unit-hardware-observer-28/charm/venv/prometheus_hardware_exporter/collector.py", line 1036, in fetch
Sep 02 18:37:32 dichy0318 python3[2333168]: ) = redfish_helper.get_storage_controller_data()
Sep 02 18:37:32 dichy0318 python3[2333168]: File "/var/lib/juju/agents/unit-hardware-observer-28/charm/venv/prometheus_hardware_exporter/collectors/redfish.py", line 306, in get_storage_controller_data
Sep 02 18:37:32 dichy0318 python3[2333168]: storage_controllers_list: List[Dict] = self.redfish_obj.get(curr_storage_uri).dict[
Sep 02 18:37:32 dichy0318 python3[2333168]: KeyError: 'StorageControllers'
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 INFO Attempt 1 of /redfish/v1/SessionService/Sessions/319876
Sep 02 18:37:32 dichy0318 python3[2333168]: 2026-09-02 18:37:32 INFO Response Time for DELETE to /redfish/v1/SessionService/Sessions/319876: 0.08308055624365807 seconds.
```

### Reproduce / Test

N/A

### Notes & References

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in prometheus_hardware_exporter/collectors/redfish.py at get_storage_controller_data(), then trace its call from collector.py fetch. Verify the handling of a Storage resource without StorageControllers and run the relevant test suite. Done means CPU.1 no longer aborts collection and remaining storage resources continue processing.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus, python
Domain
backend, observability-sre
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.