diff --git a/src/lib/y2storage/proposal/devices_planner.rb b/src/lib/y2storage/proposal/devices_planner.rb index 4a2260f74..790a1641e 100644 --- a/src/lib/y2storage/proposal/devices_planner.rb +++ b/src/lib/y2storage/proposal/devices_planner.rb @@ -287,6 +287,8 @@ def adjust_sizes(planned_device, volume) planned_device.min_size = min_size(volume) planned_device.max_size = max_size(volume) + return if volume.ignore_adjust_by_ram? + if volume.adjust_by_ram? planned_device.min_size = [planned_device.min_size, ram_size].max planned_device.max_size = [planned_device.max_size, ram_size].max diff --git a/src/lib/y2storage/volume_specification.rb b/src/lib/y2storage/volume_specification.rb index a6ec332e4..ae3ceca1c 100644 --- a/src/lib/y2storage/volume_specification.rb +++ b/src/lib/y2storage/volume_specification.rb @@ -177,10 +177,16 @@ class VolumeSpecification # @return [Boolean] true if #snapshots_size and #snapshots_percentage should be ignored attr_accessor :ignore_snapshots_sizes + # Whether to ignore any possible effect on the size derived from RAM size + # + # @return [Boolean] true if #adjust_by_ram should be ignored + attr_accessor :ignore_adjust_by_ram + alias_method :proposed?, :proposed alias_method :proposed_configurable?, :proposed_configurable alias_method :adjust_by_ram?, :adjust_by_ram alias_method :adjust_by_ram_configurable?, :adjust_by_ram_configurable + alias_method :ignore_adjust_by_ram?, :ignore_adjust_by_ram alias_method :snapshots?, :snapshots alias_method :snapshots_configurable?, :snapshots_configurable alias_method :ignore_snapshots_sizes?, :ignore_snapshots_sizes @@ -380,6 +386,7 @@ def apply_defaults @fs_types = [] @ignore_fallback_sizes = false @ignore_snapshots_sizes = false + @ignore_adjust_by_ram = false @reformat = true end diff --git a/test/y2storage/proposal/devices_planner_test.rb b/test/y2storage/proposal/devices_planner_test.rb index 9703cf2aa..c72b0d8bd 100755 --- a/test/y2storage/proposal/devices_planner_test.rb +++ b/test/y2storage/proposal/devices_planner_test.rb @@ -472,6 +472,12 @@ expect(planned_device.min_size).to eq(8.GiB) expect(planned_device.max_size).to eq(8.GiB) end + + it "does not extend the sizes to ram size if #ignore_adjust_by_ram is set" do + vol_in_settings.ignore_adjust_by_ram = true + expect(planned_device.min_size).to eq(1.GiB) + expect(planned_device.max_size).to eq(2.GiB) + end end context "when it is planning a device with btrfs filesystem" do