diff --git a/service/lib/agama/storage/manager.rb b/service/lib/agama/storage/manager.rb index c7a66ef413..f5311b5e77 100644 --- a/service/lib/agama/storage/manager.rb +++ b/service/lib/agama/storage/manager.rb @@ -28,6 +28,7 @@ require "agama/storage/callbacks" require "agama/storage/iscsi/manager" require "agama/storage/finisher" +require "agama/storage/proposal_settings_reader" require "agama/issue" require "agama/with_issues" require "agama/with_progress" diff --git a/service/lib/agama/storage/proposal_settings_reader.rb b/service/lib/agama/storage/proposal_settings_reader.rb index 6d1cd79e2d..82cf9ab836 100644 --- a/service/lib/agama/storage/proposal_settings_reader.rb +++ b/service/lib/agama/storage/proposal_settings_reader.rb @@ -40,6 +40,7 @@ def read config.data.fetch("storage", {}).each do |key, value| send(READERS[key], settings, value) end + settings end private diff --git a/service/test/agama/storage/manager_test.rb b/service/test/agama/storage/manager_test.rb index db177b5380..8a8ae646aa 100644 --- a/service/test/agama/storage/manager_test.rb +++ b/service/test/agama/storage/manager_test.rb @@ -72,7 +72,7 @@ let(:raw_devicegraph) { instance_double(Y2Storage::Devicegraph, probing_issues: []) } - let(:proposal) { Agama::Storage::Proposal.new(logger, config) } + let(:proposal) { Agama::Storage::Proposal.new(config, logger: logger) } let(:callback) { proc {} } @@ -163,7 +163,7 @@ instance_double(Y2Storage::Devicegraph, probing_issues: probing_issues) end - let(:proposal) { Agama::Storage::Proposal.new(logger, config) } + let(:proposal) { Agama::Storage::Proposal.new(config, logger: logger) } let(:iscsi) { Agama::Storage::ISCSI::Manager.new } diff --git a/service/test/fixtures/root_dir/etc/agama.yaml b/service/test/fixtures/root_dir/etc/agama.yaml index 3fd00951fa..c87e4013ad 100644 --- a/service/test/fixtures/root_dir/etc/agama.yaml +++ b/service/test/fixtures/root_dir/etc/agama.yaml @@ -57,72 +57,71 @@ Tumbleweed: storage: volumes: - - mount_point: "/" - fs_type: btrfs - desired_size: 10 GiB - min_size: 5 GiB - max_size: unlimited - weight: 30 + - "/" + - "swap" + volume_templates: + - mount_path: "/" + filesystem: btrfs + btrfs: + snapshots: true + read_only_root: true + default_subvolume: "@" + subvolumes: + - path: home + - path: opt + - path: root + - path: srv + - path: usr/local + # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html + - path: var + copy_on_write: false - # There must always be a root - proposed_configurable: false + # Architecture specific subvolumes + - path: boot/grub2/arm64-efi + archs: aarch64 + - path: boot/grub2/arm-efi + archs: arm + - path: boot/grub2/i386-pc + archs: x86_64 + - path: boot/grub2/powerpc-ieee1275 + archs: ppc,!board_powernv + - path: boot/grub2/s390x-emu + archs: s390 + - path: boot/grub2/x86_64-efi + archs: x86_64 + - path: boot/grub2/riscv64-efi + archs: riscv64 - snapshots: true - snapshots_percentage: 250 - snapshots_configurable: true - # Disable snapshots if there is not enough room - disable_order: 3 + size: + auto: true + outline: + required: true + auto_size: + base_min: 5 GiB + base_max: 20 GiB + snapshots_increment: 10 GiB + min_fallback_for: + - "/home" + - "/home" + snapshots_configurable: true - btrfs_default_subvolume: "@" - subvolumes: - - path: home - - path: opt - - path: root - - path: srv - - path: usr/local - # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html - - path: var - copy_on_write: false + - mount_path: "/home" + filesystem: xfs + size: + auto: false + min: 10 GiB + max: unlimited + outline: + required: false - # Architecture specific subvolumes - - path: boot/grub2/arm64-efi - archs: aarch64 - - path: boot/grub2/arm-efi - archs: arm - - path: boot/grub2/i386-pc - archs: x86_64 - - path: boot/grub2/powerpc-ieee1275 - archs: ppc,!board_powernv - - path: boot/grub2/s390x-emu - archs: s390 - - path: boot/grub2/x86_64-efi - archs: x86_64 - - path: boot/grub2/riscv64-efi - archs: riscv64 - - - mount_point: "/home" - fs_type: xfs - desired_size: 40 GiB - min_size: 10 GiB - max_size: unlimited - weight: 60 - - proposed: false - proposed_configurable: true - disable_order: 1 - - - mount_point: "swap" - fs_type: swap - desired_size: 2 GiB - min_size: 1 GiB - max_size: 2 GiB - weight: 10 - - adjust_by_ram: false - adjust_by_ram_configurable: true - - proposed_configurable: true - disable_order: 2 + - mount_path: "swap" + filesystem: swap + size: + auto: false + min: 1 GiB + max: 2 GiB + outline: + required: false Leap: software: @@ -155,69 +154,71 @@ Leap: storage: volumes: - - mount_point: "/" - fs_type: btrfs - desired_size: 10 GiB - min_size: 5 GiB - max_size: unlimited - weight: 30 - - # There must always be a root - proposed_configurable: false - - snapshots: true - snapshots_percentage: 250 - snapshots_configurable: true - # Disable snapshots if there is not enough room - disable_order: 3 + - "/" + - "swap" + volume_templates: + - mount_path: "/" + filesystem: btrfs + btrfs: + snapshots: true + read_only_root: true + default_subvolume: "@" + subvolumes: + - path: home + - path: opt + - path: root + - path: srv + - path: usr/local + # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html + - path: var + copy_on_write: false - btrfs_default_subvolume: "@" - subvolumes: - - path: home - - path: opt - - path: root - - path: srv - - path: usr/local - # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html - - path: var - copy_on_write: false + # Architecture specific subvolumes + - path: boot/grub2/arm64-efi + archs: aarch64 + - path: boot/grub2/arm-efi + archs: arm + - path: boot/grub2/i386-pc + archs: x86_64 + - path: boot/grub2/powerpc-ieee1275 + archs: ppc,!board_powernv + - path: boot/grub2/s390x-emu + archs: s390 + - path: boot/grub2/x86_64-efi + archs: x86_64 + - path: boot/grub2/riscv64-efi + archs: riscv64 - # Architecture specific subvolumes - - path: boot/grub2/arm64-efi - archs: aarch64 - - path: boot/grub2/i386-pc - archs: x86_64 - - path: boot/grub2/powerpc-ieee1275 - archs: ppc,!board_powernv - - path: boot/grub2/s390x-emu - archs: s390 - - path: boot/grub2/x86_64-efi - archs: x86_64 - - - mount_point: "/home" - fs_type: xfs - desired_size: 40 GiB - min_size: 10 GiB - max_size: unlimited - weight: 60 - - proposed: false - proposed_configurable: true - disable_order: 1 - - - mount_point: "swap" - fs_type: swap - desired_size: 2 GiB - min_size: 1 GiB - max_size: 2 GiB - weight: 10 + size: + auto: true + outline: + required: true + auto_size: + base_min: 5 GiB + base_max: 20 GiB + snapshots_increment: 10 GiB + min_fallback_for: + - "/home" + - "/home" + snapshots_configurable: true - adjust_by_ram: false - adjust_by_ram_configurable: true - - proposed_configurable: true - disable_order: 2 + - mount_path: "/home" + filesystem: xfs + size: + auto: false + min: 10 GiB + max: unlimited + outline: + required: false + - mount_path: "swap" + filesystem: swap + size: + auto: false + min: 1 GiB + max: 2 GiB + outline: + required: false Leap Micro: software: @@ -243,21 +244,17 @@ Leap Micro: patterns: null storage: - volumes: - - mount_point: "/" - fs_type: btrfs - desired_size: 20 GiB - min_size: 5 GiB - max_size: 20 GiB - fs_types: - - btrfs - weight: 20 - snapshots: true - snapshots_configurable: false - proposed_configurable: false - btrfs_default_subvolume: "@" - btrfs_read_only: true - subvolumes: + volumes: + - "/" + - "/var" + volume_templates: + - mount_path: "/" + filesystem: btrfs + btrfs: + snapshots: true + read_only_root: true + default_subvolume: "@" + subvolumes: - path: root - path: home - path: opt @@ -275,17 +272,25 @@ Leap Micro: archs: s390 - path: boot/grub2/x86_64-efi archs: x86_64 - - mount_point: "/var" - fs_type: btrfs - fs_types: - - btrfs - desired_size: 19 GiB - min_size: 5 GiB - max_size: unlimited - weight: 40 - snapshots: false - snapshots_configurable: false - disable_order: 1 - fallback_for_desired_size: "/" - fallback_for_max_size: "/" - fallback_for_weight: "/" + + size: + auto: true + outline: + required: true + auto_size: + base_min: 5 GiB + base_max: 20 GiB + snapshots_increment: 10 GiB + min_fallback_for: + - "/var" + - "/var" + snapshots_configurable: false + + - mount_path: "/var" + filesystem: btrfs + size: + auto: false + min: 5 GiB + max: unlimited + outline: + required: false