Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-19135

Satellite fails to perform kexec as a part of discovery process if no PXELoader is selected for the host profile

XMLWordPrintable

    • Rocket Sprint 12
    • Moderate
    • True

      Description of problem:

      Satellite fails to perform kexec as a part of the discovery process if no PXELoader is selected for the host profile

      Version-Release number of selected component (if applicable):

      Satellite 6.12.4 and later

      How reproducible:

      100%

      Steps to Reproduce:

      1. Install and configure a Satellite 6.12 for PXELess discovery-based deployment

      2. Setup Hostgroups and discovery rules as per https://www.redhat.com/en/blog/provisioning-discovery-rules-red-hat-satellite-6

      3. Ensure that the PXELoader is unselected in the Hostgroup i.e. blank\nil.

      4. You can use either Discovery ISO or boot the blank system from network to get the Discovery many and start booting from Discovery

      5. As soon as it shows the message about auto-discovery, hit some key to interrupt the process and then on the next screen, use DHCP or Static discovery options.

      This interruption will ensure that kexec happens at the end.

      6. Monitor the overall process.

      Actual results:

      Host is discovered, a new host profile is created and submitted for build but kexec would not be possible due to the following traceback

      ~~
      2023-07-24T15:55:49 [W|app|75f82e89] Unable render or parse kexec template, must be valid JSON
      2023-07-24T15:55:49 [I|app|75f82e89] Backtrace for 'Unable render or parse kexec template, must be valid JSON' error (NoMethodError): undefined method `include?' for nil:NilClass
      75f82e89 | Discovery Red Hat kexec:17:in `get_binding'
      75f82e89 | /usr/share/ruby/erb.rb:905:in `eval'
      75f82e89 | /usr/share/ruby/erb.rb:905:in `result'
      75f82e89 | /usr/share/foreman/app/services/foreman/renderer/unsafe_mode_renderer.rb:7:in `render'
      75f82e89 | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render'
      75f82e89 | /usr/share/foreman/app/services/foreman/renderer.rb:46:in `render'
      75f82e89 | /usr/share/foreman/app/models/template.rb:172:in `render'
      75f82e89 | /usr/share/foreman/app/models/host/base.rb:348:in `render_template'
      75f82e89 | /usr/share/gems/gems/foreman_discovery-21.0.5/app/models/host/managed_extensions.rb:48:in `render_kexec_template'
      75f82e89 | /usr/share/gems/gems/foreman_discovery-21.0.5/app/models/host/managed_extensions.rb:58:in `setKexec'
      75f82e89 | /usr/share/foreman/app/models/concerns/orchestration.rb:227:in `execute'
      ~~

      Reason: The Hostgroup has no PXE Loader selected and hence Host also inherited a null value but https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb#L48 expects some loader to be selected so that it can search for the "SecureBoot" string.

      extra << "--kexec-file-syscall" if @host.pxe_loader.include?('SecureBoot')

      Expected results:

      No such issues. Discovery Kexec should happen even if no PXELoaders are selected.

      Additional info:

      We can solve it in two ways:

      • Select the PXE Loader as "None" instead of leaving it blank. This allows both LEgacy BIOS and UEFI builds to happen without needing to specify any related loaders for the hostgroup or host.
      • [ least preferable option i guess ]

      Change

      extra << "--kexec-file-syscall" if @host.pxe_loader.include?('SecureBoot')

      to

      extra << "--kexec-file-syscall" if @host.pxe_loader && @host.pxe_loader.include?('SecureBoot')

      And then leaving the PXELoader blank\unselected will work.

      [ But I still prefer to select None instead of this change ]

            sat-lstejska Leos Stejskal (Inactive)
            rhn-support-saydas Sayan Das
            Shweta Singh Shweta Singh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: