diff --git a/products.d/slowroll.yaml b/products.d/slowroll.yaml index 421a8e271d..0b949469ec 100644 --- a/products.d/slowroll.yaml +++ b/products.d/slowroll.yaml @@ -79,6 +79,7 @@ security: patterns: null storage: + boot_strategy: BLS space_policy: delete volumes: - "/" diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 13c76d47d3..9d3fdef59c 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -130,6 +130,7 @@ security: patterns: null storage: + boot_strategy: BLS space_policy: delete volumes: - "/" diff --git a/service/lib/agama/config.rb b/service/lib/agama/config.rb index 8c51602c4f..b36ec4c524 100644 --- a/service/lib/agama/config.rb +++ b/service/lib/agama/config.rb @@ -217,6 +217,13 @@ def lvm? data.dig("storage", "lvm") || false end + # Boot strategy for the product + # + # @return [String, nil] + def boot_strategy + data.dig("storage", "boot_strategy") + end + private def mandatory_path?(path) diff --git a/service/lib/agama/storage/manager.rb b/service/lib/agama/storage/manager.rb index cee30a8bef..6109bb19e2 100644 --- a/service/lib/agama/storage/manager.rb +++ b/service/lib/agama/storage/manager.rb @@ -22,6 +22,7 @@ require "yast" require "bootloader/proposal_client" require "y2storage/storage_manager" +require "y2storage/storage_env" require "y2storage/clients/inst_prepdisk" require "agama/storage/actions_generator" require "agama/storage/bootloader" @@ -119,6 +120,12 @@ def on_probe(&block) def probe(keep_config: false) start_progress_with_size(4) product_config.pick_product(software.selected_product) + + # Underlying yast-storage-ng has own mechanism for proposing boot strategies. + # However, we don't always want to use BLS when it proposes so. Currently + # we want to use BLS only for Tumbleweed / Slowroll + prohibit_bls_boot if !product_config.boot_strategy&.casecmp("BLS") + check_multipath progress.step(_("Activating storage devices")) { activate_devices } progress.step(_("Probing storage devices")) { probe_devices } @@ -214,6 +221,12 @@ def locale=(locale) # @return [Logger] attr_reader :logger + def prohibit_bls_boot + ENV["YAST_NO_BLS_BOOT"] = "1" + # avoiding problems with cached values + Y2Storage::StorageEnv.instance.reset_cache + end + # Issues are updated when the proposal is calculated def register_proposal_callbacks proposal.on_calculate { update_issues } diff --git a/service/package/rubygem-agama-yast.changes b/service/package/rubygem-agama-yast.changes index da32a598b3..089e770688 100644 --- a/service/package/rubygem-agama-yast.changes +++ b/service/package/rubygem-agama-yast.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Mar 5 08:09:28 UTC 2025 - Michal Filka + +- introduced boot_strategy into storage section of product + definition yaml file. It allows to control what boot strategy + will be proposed by storage. Currently works only for BLS. + ------------------------------------------------------------------- Wed Feb 26 06:52:45 UTC 2025 - José Iván López González diff --git a/service/test/agama/storage/manager_test.rb b/service/test/agama/storage/manager_test.rb index 9d0faf2b05..8fab9f4e4d 100644 --- a/service/test/agama/storage/manager_test.rb +++ b/service/test/agama/storage/manager_test.rb @@ -218,6 +218,14 @@ let(:callback) { proc {} } + it "sets env YAST_NO_BLS_BOOT to yes if product doesn't requires bls boot explicitly" do + expect(config).to receive(:pick_product) + expect(config).to receive(:boot_strategy).and_return(nil) + expect(ENV).to receive(:[]=).with("YAST_NO_BLS_BOOT", "1") + + storage.probe + end + it "probes the storage devices and calculates a proposal" do expect(config).to receive(:pick_product).with("ALP") expect(iscsi).to receive(:activate)