-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
-
Quality / Stability / Reliability
-
False
-
-
False
-
None
-
-
None
Description
The SCSI persistent reservation section in the Virtualization Settings page (Cluster tab) crashes with the error:
> Error: Cannot read properties of null (reading 'metadata')
Root Cause
In PersistentReservationSection.tsx, the Switch component is rendered when hyperLoaded is true, but the hyperConverge object can still be null (e.g., when the HyperConverged resource list is empty — getHyperConvergedObject returns null for an empty array).
When the Switch is toggled (or the component attempts to interact with the resource), onChange passes the null hyperConverge as resource to k8sPatch, which then tries to access resource.metadata.namespace and resource.metadata.name, resulting in the crash.
Steps to Reproduce
-
- Navigate to Virtualization > Settings > Cluster tab
2. Scroll to the "SCSI persistent reservation" section
3. Observe the error displayed in the UI
- Navigate to Virtualization > Settings > Cluster tab
Expected Behavior
The Switch should only be rendered when the HyperConverged resource is available (not null). If the resource is null, the Switch should be hidden or disabled.
Fix
-
- Add a null guard in onChange: if (!hyperConverge) return;
2. Add hyperConverge to the render condition: change hyperLoaded && to hyperLoaded && hyperConverge &&
- Add a null guard in onChange: if (!hyperConverge) return;
Affected File
src/views/clusteroverview/SettingsTab/ClusterTab/components/PersistentReservationSection/PersistentReservationSection.tsx