Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package yast2-storage-ng for openSUSE:Factory checked in at 2023-10-22 21:01:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-storage-ng (Old) and /work/SRC/openSUSE:Factory/.yast2-storage-ng.new.1945 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-storage-ng" Sun Oct 22 21:01:00 2023 rev:148 rq:1119179 version:5.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-storage-ng/yast2-storage-ng.changes 2023-09-28 00:28:14.290613069 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-storage-ng.new.1945/yast2-storage-ng.changes 2023-10-22 21:01:01.491468560 +0200 @@ -1,0 +2,14 @@ +Thu Oct 19 14:46:45 UTC 2023 - Ancor Gonzalez Sosa <an...@suse.com> + +- GuidedProposal: new internal setting to control how existing + swap partitions are reused. Relevant for Agama and related to + bsc#1175535 and bsc#1215639. +- 5.0.3 + +------------------------------------------------------------------- +Wed Oct 11 08:41:15 UTC 2023 - Ancor Gonzalez Sosa <an...@suse.com> + +- New MdLevel value for linear RAIDs (bsc#1215022) +- 5.0.2 + +------------------------------------------------------------------- Old: ---- yast2-storage-ng-5.0.1.tar.bz2 New: ---- yast2-storage-ng-5.0.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-storage-ng.spec ++++++ --- /var/tmp/diff_new_pack.luR8EJ/_old 2023-10-22 21:01:02.435502886 +0200 +++ /var/tmp/diff_new_pack.luR8EJ/_new 2023-10-22 21:01:02.439503032 +0200 @@ -17,7 +17,7 @@ Name: yast2-storage-ng -Version: 5.0.1 +Version: 5.0.3 Release: 0 Summary: YaST2 - Storage Configuration License: GPL-2.0-only OR GPL-3.0-only ++++++ yast2-storage-ng-5.0.1.tar.bz2 -> yast2-storage-ng-5.0.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/package/yast2-storage-ng.changes new/yast2-storage-ng-5.0.3/package/yast2-storage-ng.changes --- old/yast2-storage-ng-5.0.1/package/yast2-storage-ng.changes 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/package/yast2-storage-ng.changes 2023-10-20 10:38:38.000000000 +0200 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Thu Oct 19 14:46:45 UTC 2023 - Ancor Gonzalez Sosa <an...@suse.com> + +- GuidedProposal: new internal setting to control how existing + swap partitions are reused. Relevant for Agama and related to + bsc#1175535 and bsc#1215639. +- 5.0.3 + +------------------------------------------------------------------- +Wed Oct 11 08:41:15 UTC 2023 - Ancor Gonzalez Sosa <an...@suse.com> + +- New MdLevel value for linear RAIDs (bsc#1215022) +- 5.0.2 + +------------------------------------------------------------------- Fri Sep 22 08:27:34 UTC 2023 - Ancor Gonzalez Sosa <an...@suse.com> - AutoYaST: official support for LUKS2 (jsc#PED-3878, jsc#PED-5518) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/package/yast2-storage-ng.spec new/yast2-storage-ng-5.0.3/package/yast2-storage-ng.spec --- old/yast2-storage-ng-5.0.1/package/yast2-storage-ng.spec 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/package/yast2-storage-ng.spec 2023-10-20 10:38:38.000000000 +0200 @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 5.0.1 +Version: 5.0.3 Release: 0 Summary: YaST2 - Storage Configuration License: GPL-2.0-only OR GPL-3.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/src/lib/y2storage/autoinst_profile/raid_options_section.rb new/yast2-storage-ng-5.0.3/src/lib/y2storage/autoinst_profile/raid_options_section.rb --- old/yast2-storage-ng-5.0.1/src/lib/y2storage/autoinst_profile/raid_options_section.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/src/lib/y2storage/autoinst_profile/raid_options_section.rb 2023-10-20 10:38:38.000000000 +0200 @@ -90,7 +90,7 @@ # @param md [Md] RAID device def init_from_raid(md) @raid_name = md.name unless md.numeric? - @raid_type = md.md_level.to_s + @raid_type = clone_md_level(md).to_s # A number will be interpreted as KB, so we explicitly set the unit. @chunk_size = "#{md.chunk_size.to_i}B" @parity_algorithm = md.md_parity.to_s @@ -109,6 +109,23 @@ MdParity.find_with_legacy(parity_algorithm) end + + private + + # MD level to be used at {#init_from_raid} + # + # This is a temporary method, created in the context of bsc#1215022, to avoid creating + # entries with "<raid_type>linear</raid_type>" in the AutoYaST profile when cloning the + # system. That may lead to the false impression that creation of linear RAIDs with YaST + # is supported. + # + # In more modern branches, the case of linear RAIDs will probably be handled differently. + # + # @param md [Md] RAID device + # @return [MdLevel] + def clone_md_level(md) + md.md_level.is?(:linear) ? MdLevel::UNKNOWN : md.md_level + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/src/lib/y2storage/md_level.rb new/yast2-storage-ng-5.0.3/src/lib/y2storage/md_level.rb --- old/yast2-storage-ng-5.0.1/src/lib/y2storage/md_level.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/src/lib/y2storage/md_level.rb 2023-10-20 10:38:38.000000000 +0200 @@ -38,7 +38,9 @@ raid5: N_("RAID5"), raid6: N_("RAID6"), raid10: N_("RAID10"), - container: N_("Container") + container: N_("Container"), + # TRANSLATOR: RAID level for linear RAIDs + linear: N_("Linear") } private_constant :TRANSLATIONS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/src/lib/y2storage/proposal/devices_planner.rb new/yast2-storage-ng-5.0.3/src/lib/y2storage/proposal/devices_planner.rb --- old/yast2-storage-ng-5.0.1/src/lib/y2storage/proposal/devices_planner.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/src/lib/y2storage/proposal/devices_planner.rb 2023-10-20 10:38:38.000000000 +0200 @@ -93,21 +93,40 @@ # @param required_size [DiskSize] # @return [Partition] def reusable_swap(required_size) - return nil if settings.use_lvm || settings.use_encryption + return nil unless try_to_reuse_swap? partitions = available_swap_partitions - partitions.select! { |part| part.size >= required_size } + partitions.select! { |part| can_be_reused?(part, required_size) } # Use #name in case of #size tie to provide stable sorting partitions.min_by { |part| [part.size, part.name] } end - # Returns all avaiable swap partitions + # Returns all available and acceptable swap partitions # # @return [Array<Partition>] def available_swap_partitions devicegraph.partitions.select(&:swap?) end + # Whether it makes sense to try to reuse existing swap partitions + # + # @return [Boolean] + def try_to_reuse_swap? + !settings.use_lvm && !settings.use_encryption && settings.swap_reuse != :none + end + + # Whether it is acceptable to reuse the given swap partition + # + # @param partition [Partition] + # @param required_size [DiskSize] + # @return [Boolean] + def can_be_reused?(partition, required_size) + return false if partition.size < required_size + return true unless settings.swap_reuse == :candidate + + settings.candidate_devices.include?(partition.partitionable.name) + end + # Delete shadowed subvolumes from each planned device # @param planned_devices [Array<Planned::Device>] devices that have been planned def remove_shadowed_subvolumes(planned_devices) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/src/lib/y2storage/proposal_settings.rb new/yast2-storage-ng-5.0.3/src/lib/y2storage/proposal_settings.rb --- old/yast2-storage-ng-5.0.1/src/lib/y2storage/proposal_settings.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/src/lib/y2storage/proposal_settings.rb 2023-10-20 10:38:38.000000000 +0200 @@ -62,6 +62,15 @@ # available candidate devices. attr_accessor :multidisk_first + # Criteria to use if it is possible to reuse an existing swap partition + # + # * :any reuse a suitable swap partition from any disk, default historical behavior of YaST + # * :none do not reuse existing swap partitions + # * :candidate reuse a suitable partition only if it is located in a candidate disk + # + # @return [:any, :none, :candidate] + attr_accessor :swap_reuse + # Device name of the disk in which '/' must be placed. # # If it's set to nil and {#allocate_volume_mode} is :auto, the proposal will try @@ -388,6 +397,7 @@ other_delete_mode: :ondemand, resize_windows: true, separate_vgs: false, + swap_reuse: :any, volumes: [], windows_delete_mode: :ondemand } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/test/data/devicegraphs/autoyast_drive_examples.yml new/yast2-storage-ng-5.0.3/test/data/devicegraphs/autoyast_drive_examples.yml --- old/yast2-storage-ng-5.0.1/test/data/devicegraphs/autoyast_drive_examples.yml 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/test/data/devicegraphs/autoyast_drive_examples.yml 2023-10-20 10:38:38.000000000 +0200 @@ -40,9 +40,9 @@ - partition: size: 1 GiB name: /dev/dasdb1 + id: swap file_system: swap - mount_point: swap - label: swap + label: swap_dasdb - partition: size: 6 GiB @@ -73,8 +73,7 @@ name: /dev/sdc2 id: swap file_system: swap - mount_point: swap - label: swap + label: swap_sdc - partition: size: 20 GiB @@ -162,7 +161,7 @@ type: logical id: swap file_system: swap - mount_point: swap + label: swap_sdd - partition: size: 10 GiB @@ -215,6 +214,7 @@ type: logical id: swap file_system: swap + label: swap_sdf - partition: size: 10 GiB @@ -265,8 +265,7 @@ name: /dev/sdaa2 id: swap file_system: swap - mount_point: swap - label: swap + label: swap_sdaa - partition: size: 20 GiB @@ -328,7 +327,7 @@ name: /dev/sdh3 id: swap file_system: swap - mount_point: swap + label: swap_sdh # Btrfs with default_subvolume set to "" - disk: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/test/spec_helper.rb new/yast2-storage-ng-5.0.3/test/spec_helper.rb --- old/yast2-storage-ng-5.0.1/test/spec_helper.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/test/spec_helper.rb 2023-10-20 10:38:38.000000000 +0200 @@ -136,6 +136,9 @@ end end + allow(Y2Storage::HWInfoReader.instance).to receive(:for_device) + .and_return Y2Storage::HWInfoDisk.new + # Bcache is only supported for x86_64 architecture. Probing the devicegraph complains if Bcache is # used with another architecture. Bcache error is avoided here. Otherwise, x86_84 architecture must # to be set for every test using Bcache (which has demonstrated to be quite error prone). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/test/y2storage/hwinfo_reader_test.rb new/yast2-storage-ng-5.0.3/test/y2storage/hwinfo_reader_test.rb --- old/yast2-storage-ng-5.0.1/test/y2storage/hwinfo_reader_test.rb 2023-09-25 13:22:58.000000000 +0200 +++ new/yast2-storage-ng-5.0.3/test/y2storage/hwinfo_reader_test.rb 2023-10-20 10:38:38.000000000 +0200 @@ -29,6 +29,9 @@ let(:hwinfo_file) { "hwinfo.txt" } before do + # Disable the global mock that normally prevents calls to hwinfo + allow(reader).to receive(:for_device).and_call_original + allow(Yast::Execute).to receive(:on_target!) .with(/hwinfo/, anything, anything, anything).and_return(hwinfo_output) reader.reset diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-5.0.1/test/y2storage/proposal_swap_reuse_test.rb new/yast2-storage-ng-5.0.3/test/y2storage/proposal_swap_reuse_test.rb --- old/yast2-storage-ng-5.0.1/test/y2storage/proposal_swap_reuse_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-5.0.3/test/y2storage/proposal_swap_reuse_test.rb 2023-10-20 10:38:38.000000000 +0200 @@ -0,0 +1,147 @@ +#!/usr/bin/env rspec +# Copyright (c) [2023] SUSE LLC +# +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, contact SUSE LLC. +# +# To contact SUSE LLC about this file by physical or electronic mail, you may +# find current contact information at www.suse.com. + +require_relative "spec_helper" +require "storage" +require "y2storage" +require_relative "#{TEST_PATH}/support/proposal_examples" +require_relative "#{TEST_PATH}/support/proposal_context" + +describe Y2Storage::GuidedProposal do + describe "#propose in a system with pre-existing swap partitions" do + subject(:proposal) { described_class.new(settings: settings) } + + include_context "proposal" + let(:architecture) { :x86 } + let(:settings_format) { :ng } + let(:control_file_content) do + { "partitioning" => { "volumes" => volumes } } + end + + let(:scenario) { "autoyast_drive_examples" } + + let(:volumes) { [root_vol, swap_vol] } + let(:root_vol) do + { "mount_point" => "/", "fs_type" => "xfs", "min_size" => "5 GiB", "max_size" => "30 GiB" } + end + let(:swap_vol) do + { "mount_point" => "swap", "fs_type" => "swap", "min_size" => "500 MiB", "max_size" => "2 GiB" } + end + + RSpec.shared_examples "reuse best swap" do + it "reuses the pre-existing swap with more suitable size" do + proposal.propose + dasdb1 = proposal.devices.find_by_name("/dev/dasdb1") + expect(dasdb1.exists_in_probed?).to eq true + expect(dasdb1).to have_attributes( + # This proves is mounted as swap + filesystem_mountpoint: "swap", + # This proves is not re-formatted + filesystem_label: "swap_dasdb", + size: Y2Storage::DiskSize.GiB(1) + ) + end + end + + RSpec.shared_examples "new swap" do + it "creates a new swap partition" do + proposal.propose + swap = proposal.devices.partitions.find { |p| p.filesystem&.mount_path == "swap" } + expect(swap.exists_in_probed?).to eq false + # All preexisting partitions have some label + expect(swap.filesystem.label).to be_empty + end + end + + before { settings.candidate_devices = [candidate] } + + context "when swap_reuse is set to :any" do + before { settings.swap_reuse = :any } + + context "and there is no swap in the candidate devices" do + let(:candidate) { "/dev/sda" } + + include_examples "reuse best swap" + end + + context "and there is a swap device (not the best regarding size) in the candidate devices" do + let(:candidate) { "/dev/sdc" } + + include_examples "reuse best swap" + end + + context "and the best swap device in the candidate devices" do + let(:candidate) { "/dev/dasdb" } + + include_examples "reuse best swap" + end + end + + context "when swap_reuse is set to :none" do + before { settings.swap_reuse = :none } + + context "and there is no swap in the candidate devices" do + let(:candidate) { "/dev/sda" } + + include_examples "new swap" + end + + context "and there is a swap device (not the biggest one) in the candidate devices" do + let(:candidate) { "/dev/sdc" } + + include_examples "new swap" + end + + context "and the biggest swap device in the candidate devices" do + let(:candidate) { "/dev/dasdb" } + + include_examples "new swap" + end + end + + context "when swap_reuse is set to :candidate" do + before { settings.swap_reuse = :candidate } + + context "and there is no swap in the candidate devices" do + let(:candidate) { "/dev/sda" } + + include_examples "new swap" + end + + context "and there is a swap device (not the biggest one) in the candidate devices" do + let(:candidate) { "/dev/sdc" } + + it "reuses the swap partition from the candidate devices" do + proposal.propose + swap = proposal.devices.partitions.find { |p| p.filesystem&.mount_path == "swap" } + expect(swap.exists_in_probed?).to eq true + expect(swap.name).to eq "/dev/sdc2" + expect(swap.filesystem.label).to eq "swap_sdc" + end + end + + context "and the biggest swap device in the candidate devices" do + let(:candidate) { "/dev/dasdb" } + + include_examples "reuse best swap" + end + end + end +end