{"record":{"id":"7fe8d99f75fee282","repo":"theforeman/foreman","slug":"please-specify-volume-size-you-may-optionally-use","errorCode":null,"errorMessage":"Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes.","messagePattern":"Please specify volume size\\. You may optionally use suffix 'G' to specify volume size in gigabytes\\.","errorType":"validation","errorClass":"Foreman::Exception","httpStatus":null,"severity":"error","filePath":"app/models/compute_resources/foreman/model/libvirt.rb","lineNumber":339,"sourceCode":"          vol.name = \"#{args[:prefix]}-disk#{volumes.index(vol) + 1}\"\n          vol.capacity = \"#{vol.capacity}G\" unless vol.capacity.to_s.end_with?('G')\n          if vol.allocation.match(/^\\d+/) && !vol.allocation.to_s.end_with?('G')\n            vol.allocation = \"#{vol.allocation}G\"\n          end\n          vol.save\n          vols << vol\n        end\n        vols\n      rescue => e\n        logger.error \"Failure detected #{e}: removing already created volumes\" if vols.any?\n        vols.each { |vol| vol.destroy }\n        raise e\n      end\n    end\n\n    def validate_volume_capacity(vol)\n      if vol.capacity.to_s.empty? || /\\A\\d+G?\\Z/.match(vol.capacity.to_s).nil?\n        raise Foreman::Exception.new(N_(\"Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes.\"))\n      end\n    end\n\n    # Generates Secure Boot settings for Libvirt based on the provided firmware type.\n    # The `secure_boot` setting is used to properly configure and display the Firmware in the `compute_attributes` form.\n    #\n    # @param firmware [String] The firmware type.\n    # @return [Hash] A hash with secure boot settings if applicable.\n    def generate_secure_boot_settings(firmware)\n      return {} unless firmware == 'uefi_secure_boot'\n\n      {\n        firmware_features: { 'secure-boot' => 'yes', 'enrolled-keys' => 'yes' },\n        loader_attributes: { 'secure' => 'yes' },\n        secure_boot: true,\n      }\n    end\n  end","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/compute_resources/foreman/model/libvirt.rb#L321-L357","documentation":"Error \"Please specify volume size. You may optionally use suffix 'G' to specify volume size in gigabytes.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/compute_resources/foreman/model/libvirt.rb:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}