Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-79748

SCSI persistent reservation settings crash: Cannot read properties of null (reading 'metadata')

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • 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

        1. Navigate to Virtualization > Settings > Cluster tab
          2. Scroll to the "SCSI persistent reservation" section
          3. Observe the error displayed in the UI

      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

        1. Add a null guard in onChange: if (!hyperConverge) return;
          2. Add hyperConverge to the render condition: change hyperLoaded && to hyperLoaded && hyperConverge &&

      Affected File

      src/views/clusteroverview/SettingsTab/ClusterTab/components/PersistentReservationSection/PersistentReservationSection.tsx

              Unassigned Unassigned
              upalatuc@redhat.com Ugo Palatucci
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: