Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-bootloader for 
openSUSE:Factory checked in at 2021-01-29 14:56:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-bootloader.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-bootloader"

Fri Jan 29 14:56:53 2021 rev:302 rq:867183 version:4.3.20

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes        
2021-01-25 18:23:11.860392578 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-bootloader.new.28504/yast2-bootloader.changes 
    2021-01-29 14:57:06.269510045 +0100
@@ -1,0 +2,14 @@
+Wed Jan 27 10:59:26 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <[email protected]>
+
+- Do not propose resume kernel parameter when the swap is smaller
+  than the RAM size (bsc#1180977).
+- 4.3.20
+
+-------------------------------------------------------------------
+Tue Jan 26 16:54:23 UTC 2021 - Ancor Gonzalez Sosa <[email protected]>
+
+- Ensure the proposal is re-calculated when the partitioning plan
+  has changed (bsc#1180218 and bsc#1180976)
+- 4.3.19
+
+-------------------------------------------------------------------

Old:
----
  yast2-bootloader-4.3.18.tar.bz2

New:
----
  yast2-bootloader-4.3.20.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.arYFCM/_old  2021-01-29 14:57:08.173512846 +0100
+++ /var/tmp/diff_new_pack.arYFCM/_new  2021-01-29 14:57:08.177512852 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.3.18
+Version:        4.3.20
 Release:        0
 Summary:        YaST2 - Bootloader Configuration
 License:        GPL-2.0-or-later

++++++ yast2-bootloader-4.3.18.tar.bz2 -> yast2-bootloader-4.3.20.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.3.18/package/yast2-bootloader.changes 
new/yast2-bootloader-4.3.20/package/yast2-bootloader.changes
--- old/yast2-bootloader-4.3.18/package/yast2-bootloader.changes        
2021-01-21 16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/package/yast2-bootloader.changes        
2021-01-27 13:48:33.000000000 +0100
@@ -1,4 +1,18 @@
 -------------------------------------------------------------------
+Wed Jan 27 10:59:26 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <[email protected]>
+
+- Do not propose resume kernel parameter when the swap is smaller
+  than the RAM size (bsc#1180977).
+- 4.3.20
+
+-------------------------------------------------------------------
+Tue Jan 26 16:54:23 UTC 2021 - Ancor Gonzalez Sosa <[email protected]>
+
+- Ensure the proposal is re-calculated when the partitioning plan
+  has changed (bsc#1180218 and bsc#1180976)
+- 4.3.19
+
+-------------------------------------------------------------------
 Thu Jan 21 14:53:55 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <[email protected]>
 
 - Fix unit tests (bsc#1181175).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.3.18/package/yast2-bootloader.spec 
new/yast2-bootloader-4.3.20/package/yast2-bootloader.spec
--- old/yast2-bootloader-4.3.18/package/yast2-bootloader.spec   2021-01-21 
16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/package/yast2-bootloader.spec   2021-01-27 
13:48:33.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.3.18
+Version:        4.3.20
 Release:        0
 Summary:        YaST2 - Bootloader Configuration
 License:        GPL-2.0-or-later
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.3.18/src/lib/bootloader/grub2base.rb 
new/yast2-bootloader-4.3.20/src/lib/bootloader/grub2base.rb
--- old/yast2-bootloader-4.3.18/src/lib/bootloader/grub2base.rb 2021-01-21 
16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/src/lib/bootloader/grub2base.rb 2021-01-27 
13:48:33.000000000 +0100
@@ -372,13 +372,20 @@
 
     def propose_resume
       swap_parts = Yast::BootStorage.available_swap_partitions
-      largest_swap_part = (swap_parts.max_by { |_part, size| size } || 
[""]).first
+      largest_swap_name, lagest_swap_size = (swap_parts.max_by { |_part, size| 
size } || [])
 
-      resume = Yast::Kernel.propose_hibernation? ? largest_swap_part : ""
-      # try to use label or udev id for device name... FATE #302219
-      resume = UdevMapping.to_mountby_device(resume) if resume != "" && 
!resume.nil?
+      propose = Yast::Kernel.propose_hibernation? && largest_swap_name
+
+      return "" unless propose
+
+      if lagest_swap_size < Yast::BootStorage.ram_size
+        log.info "resume parameter is not added because swap 
(#{largest_swap_name}) is too small"
 
-      resume
+        return ""
+      end
+
+      # try to use label or udev id for device name... FATE #302219
+      UdevMapping.to_mountby_device(largest_swap_name)
     end
 
     def propose_encrypted
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.3.18/src/lib/bootloader/proposal_client.rb 
new/yast2-bootloader-4.3.20/src/lib/bootloader/proposal_client.rb
--- old/yast2-bootloader-4.3.18/src/lib/bootloader/proposal_client.rb   
2021-01-21 16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/src/lib/bootloader/proposal_client.rb   
2021-01-27 13:48:33.000000000 +0100
@@ -131,13 +131,18 @@
 
     # make proposal without handling of exceptions
     def make_proposal_raising(attrs)
+      force_reset = attrs["force_reset"]
+      storage_read = Yast::BootStorage.storage_read?
+      # This must be checked at the beginning because the call to 
BootStorage.boot_filesystem
+      # below can trigger a re-read and change the result of 
BootStorage.storage_changed?
+      # See bsc#1180218 and bsc#1180976.
+      storage_changed = Yast::BootStorage.storage_changed?
+
       if Yast::BootStorage.boot_filesystem.is?(:nfs)
         ::Bootloader::BootloaderFactory.current_name = "none"
         return construct_proposal_map
       end
-      force_reset = attrs["force_reset"]
-      storage_read = Yast::BootStorage.storage_read?
-      storage_changed = Yast::BootStorage.storage_changed?
+
       log.info "Storage changed: #{storage_changed} force_reset 
#{force_reset}."
       log.info "Storage read previously #{storage_read.inspect}"
       # clear storage-ng devices cache otherwise it crashes (bsc#1071931)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.3.18/src/modules/BootStorage.rb 
new/yast2-bootloader-4.3.20/src/modules/BootStorage.rb
--- old/yast2-bootloader-4.3.18/src/modules/BootStorage.rb      2021-01-21 
16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/src/modules/BootStorage.rb      2021-01-27 
13:48:33.000000000 +0100
@@ -126,6 +126,13 @@
       ret
     end
 
+    # Ram size in KiB
+    #
+    # @return [Intenger]
+    def ram_size
+      Y2Storage::StorageManager.instance.arch.ram_size / 1024
+    end
+
     def encrypted_boot?
       fs = boot_filesystem
       log.info "boot mp = #{fs.inspect}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.3.18/test/bootloader_proposal_client_test.rb 
new/yast2-bootloader-4.3.20/test/bootloader_proposal_client_test.rb
--- old/yast2-bootloader-4.3.18/test/bootloader_proposal_client_test.rb 
2021-01-21 16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/test/bootloader_proposal_client_test.rb 
2021-01-27 13:48:33.000000000 +0100
@@ -196,11 +196,27 @@
       subject.make_proposal({})
     end
 
-    it "always resets if storage changed" do
+    it "does not reset the configuration if the user already changed it" do
+      # Run a first proposal
+      subject.make_proposal({})
+      # The user edits (or simply visualizes) the configuration
+      Yast::Bootloader.proposed_cfg_changed = true
+
+      expect(Yast::Bootloader).to_not receive(:Reset)
+      subject.make_proposal("force_reset" => false)
+    end
+
+    # Regression test for bsc#1180218 and bsc#1180976
+    it "resets the configuration if storage changed" do
+      # Run a first proposal
+      subject.make_proposal({})
+      # The user edits (or simply visualizes) the configuration
+      Yast::Bootloader.proposed_cfg_changed = true
+
+      Y2Storage::StorageManager.instance.increase_staging_revision
       expect(Yast::Bootloader).to receive(:Reset)
-      allow(Yast::BootStorage).to receive(:storage_changed?).and_return(true)
 
-      subject.make_proposal("force_reset" => true)
+      subject.make_proposal("force_reset" => false)
     end
 
     it "resets configuration if not automode and force_reset passed" do
@@ -209,7 +225,7 @@
       subject.make_proposal("force_reset" => true)
     end
 
-    it "do not resets configuration in automode and even if force_reset 
passed" do
+    it "does not reset configuration in automode and even if force_reset 
passed" do
       allow(Yast::Mode).to receive(:autoinst).and_return(true)
       expect(Yast::Bootloader).to_not receive(:Reset)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.3.18/test/grub2base_test.rb 
new/yast2-bootloader-4.3.20/test/grub2base_test.rb
--- old/yast2-bootloader-4.3.18/test/grub2base_test.rb  2021-01-21 
16:07:10.000000000 +0100
+++ new/yast2-bootloader-4.3.20/test/grub2base_test.rb  2021-01-27 
13:48:33.000000000 +0100
@@ -248,6 +248,8 @@
       context "on x86_64" do
         before do
           allow(Yast::Arch).to receive(:architecture).and_return("x86_64")
+          # RAM 1024 KiB
+          allow(Y2Storage::StorageManager.instance.arch).to 
receive(:ram_size).and_return(1024 * 1024)
         end
 
         it "proposes kernel parameters used in installation" do
@@ -259,18 +261,6 @@
           expect(subject.grub_default.kernel_params.serialize).to 
include(kernel_params)
         end
 
-        it "adds the biggest available swap partition as resume device" do
-          allow(Yast::BootStorage).to receive(:available_swap_partitions)
-            .and_return(
-              "/dev/sda2" => 512,
-              "/dev/sdb2" => 1024
-            )
-
-          subject.propose
-
-          expect(subject.grub_default.kernel_params.serialize).to 
include("resume=/dev/sdb2")
-        end
-
         it "adds additional kernel parameters for given product" do
           allow(Yast::ProductFeatures).to receive(:GetStringFeature)
             .with("globals", "additional_kernel_parameters")
@@ -286,6 +276,54 @@
 
           expect(subject.grub_default.kernel_params.serialize).to 
include("quiet")
         end
+
+        context "when the largest swap is bigger than the RAM size" do
+          before do
+            allow(Yast::BootStorage).to receive(:available_swap_partitions)
+              .and_return(
+                "/dev/sda2" => 512,
+                "/dev/sdb2" => 2048
+              )
+          end
+
+          it "adds the largest available swap partition as resume device" do
+            subject.propose
+
+            expect(subject.grub_default.kernel_params.serialize).to 
include("resume=/dev/sdb2")
+          end
+        end
+
+        context "when the largest swap is equal to the RAM size" do
+          before do
+            allow(Yast::BootStorage).to receive(:available_swap_partitions)
+              .and_return(
+                "/dev/sda2" => 512,
+                "/dev/sdb2" => 1024
+              )
+          end
+
+          it "adds the largest available swap partition as resume device" do
+            subject.propose
+
+            expect(subject.grub_default.kernel_params.serialize).to 
include("resume=/dev/sdb2")
+          end
+        end
+
+        context "when the largest swap is smaller than the RAM size" do
+          before do
+            allow(Yast::BootStorage).to receive(:available_swap_partitions)
+              .and_return(
+                "/dev/sda2" => 512,
+                "/dev/sdb2" => 512
+              )
+          end
+
+          it "does not add the resume parameter" do
+            subject.propose
+
+            expect(subject.grub_default.kernel_params.serialize).to_not 
include("resume=")
+          end
+        end
       end
 
       context "on s390" do

Reply via email to