theforeman/foreman · error · Foreman::Exception

Please specify volume size. You may optionally use suffix 'G

Error message

Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes.

What it means

Error "Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes." thrown in theforeman/foreman.

Source

Thrown at app/models/compute_resources/foreman/model/libvirt.rb:339

          vol.name = "#{args[:prefix]}-disk#{volumes.index(vol) + 1}"
          vol.capacity = "#{vol.capacity}G" unless vol.capacity.to_s.end_with?('G')
          if vol.allocation.match(/^\d+/) && !vol.allocation.to_s.end_with?('G')
            vol.allocation = "#{vol.allocation}G"
          end
          vol.save
          vols << vol
        end
        vols
      rescue => e
        logger.error "Failure detected #{e}: removing already created volumes" if vols.any?
        vols.each { |vol| vol.destroy }
        raise e
      end
    end

    def validate_volume_capacity(vol)
      if vol.capacity.to_s.empty? || /\A\d+G?\Z/.match(vol.capacity.to_s).nil?
        raise Foreman::Exception.new(N_("Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes."))
      end
    end

    # Generates Secure Boot settings for Libvirt based on the provided firmware type.
    # The `secure_boot` setting is used to properly configure and display the Firmware in the `compute_attributes` form.
    #
    # @param firmware [String] The firmware type.
    # @return [Hash] A hash with secure boot settings if applicable.
    def generate_secure_boot_settings(firmware)
      return {} unless firmware == 'uefi_secure_boot'

      {
        firmware_features: { 'secure-boot' => 'yes', 'enrolled-keys' => 'yes' },
        loader_attributes: { 'secure' => 'yes' },
        secure_boot: true,
      }
    end
  end

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/models/compute_resources/foreman/model/libvirt.rb:339 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/7fe8d99f75fee282. Report an issue: GitHub.