Hello community,

here is the log from the commit of package yast2-bootloader for 
openSUSE:Leap:15.2 checked in at 2020-03-31 07:22:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/yast2-bootloader (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.yast2-bootloader.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-bootloader"

Tue Mar 31 07:22:54 2020 rev:118 rq:789250 version:4.2.20

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/yast2-bootloader/yast2-bootloader.changes      
2020-03-26 05:41:05.747269978 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.yast2-bootloader.new.3160/yast2-bootloader.changes
    2020-03-31 07:22:54.546412070 +0200
@@ -1,0 +2,17 @@
+Fri Mar 27 08:19:54 UTC 2020 - Ancor Gonzalez Sosa <[email protected]>
+
+- Reverted the changes to delegate to yast2-storage-ng the
+  calculation of udev links. See previous entries for versions
+  4.2.16 and 4.2.19.
+- This fixes bsc#1167779 and is related to bsc#1166096 and
+  bsc#1151075.
+- 4.2.20
+
+-------------------------------------------------------------------
+Wed Mar 25 07:57:13 UTC 2020 - Ancor Gonzalez Sosa <[email protected]>
+
+- Fixed the calculation of the udev name used to reference devices
+  that are not formatted, like PReP partitions (bsc#1166096).
+- 4.2.19
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.GHHaMX/_old  2020-03-31 07:22:55.010412272 +0200
+++ /var/tmp/diff_new_pack.GHHaMX/_new  2020-03-31 07:22:55.010412272 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.2.18
+Version:        4.2.20
 Release:        0
 Summary:        YaST2 - Bootloader Configuration
 License:        GPL-2.0-or-later
@@ -29,8 +29,8 @@
 BuildRequires:  yast2 >= 3.1.176
 BuildRequires:  yast2-devtools >= 4.2.2
 BuildRequires:  yast2-ruby-bindings >= 1.0.0
-# Y2Storage::Mountable#preferred_mount_by
-BuildRequires:  yast2-storage-ng >= 4.2.90
+# Y2Storage::Mountable#mount_path
+BuildRequires:  yast2-storage-ng >= 4.0.90
 # lenses needed also for tests
 BuildRequires:  augeas-lenses
 BuildRequires:  update-desktop-files
@@ -46,8 +46,8 @@
 Requires:       yast2-core >= 2.18.7
 Requires:       yast2-packager >= 2.17.24
 Requires:       yast2-pkg-bindings >= 2.17.25
-# Y2Storage::Mountable#preferred_mount_by
-Requires:       yast2-storage-ng >= 4.2.90
+# Y2Storage::Mountable#mount_path
+Requires:       yast2-storage-ng >= 4.0.90
 # Support for multiple values in GRUB_TERMINAL
 Requires:       rubygem(%rb_default_ruby_abi:cfa_grub2) >= 1.0.1
 # lenses are needed as cfa_grub2 depends only on augeas bindings, but also

++++++ yast2-bootloader-4.2.18.tar.bz2 -> yast2-bootloader-4.2.20.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.2.18/package/yast2-bootloader.changes 
new/yast2-bootloader-4.2.20/package/yast2-bootloader.changes
--- old/yast2-bootloader-4.2.18/package/yast2-bootloader.changes        
2020-03-24 11:32:12.000000000 +0100
+++ new/yast2-bootloader-4.2.20/package/yast2-bootloader.changes        
2020-03-27 09:42:09.000000000 +0100
@@ -1,4 +1,21 @@
 -------------------------------------------------------------------
+Fri Mar 27 08:19:54 UTC 2020 - Ancor Gonzalez Sosa <[email protected]>
+
+- Reverted the changes to delegate to yast2-storage-ng the
+  calculation of udev links. See previous entries for versions
+  4.2.16 and 4.2.19.
+- This fixes bsc#1167779 and is related to bsc#1166096 and
+  bsc#1151075.
+- 4.2.20
+
+-------------------------------------------------------------------
+Wed Mar 25 07:57:13 UTC 2020 - Ancor Gonzalez Sosa <[email protected]>
+
+- Fixed the calculation of the udev name used to reference devices
+  that are not formatted, like PReP partitions (bsc#1166096).
+- 4.2.19
+
+-------------------------------------------------------------------
 Tue Mar 24 08:10:33 UTC 2020 - Steffen Winterfeldt <[email protected]>
 
 - support s390 secure boot (jsc#SLE-9425, jsc#SLE-9471, bsc#1166736)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.2.18/package/yast2-bootloader.spec 
new/yast2-bootloader-4.2.20/package/yast2-bootloader.spec
--- old/yast2-bootloader-4.2.18/package/yast2-bootloader.spec   2020-03-24 
11:32:12.000000000 +0100
+++ new/yast2-bootloader-4.2.20/package/yast2-bootloader.spec   2020-03-27 
09:42:09.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.2.18
+Version:        4.2.20
 Release:        0
 Summary:        YaST2 - Bootloader Configuration
 License:        GPL-2.0-or-later
@@ -29,8 +29,8 @@
 BuildRequires:  yast2 >= 3.1.176
 BuildRequires:  yast2-devtools >= 4.2.2
 BuildRequires:  yast2-ruby-bindings >= 1.0.0
-# Y2Storage::Mountable#preferred_mount_by
-BuildRequires:  yast2-storage-ng >= 4.2.90
+# Y2Storage::Mountable#mount_path
+BuildRequires:  yast2-storage-ng >= 4.0.90
 # lenses needed also for tests
 BuildRequires:  augeas-lenses
 BuildRequires:  rubygem(%rb_default_ruby_abi:cfa_grub2) >= 1.0.1
@@ -46,8 +46,8 @@
 Requires:       yast2-core >= 2.18.7
 Requires:       yast2-packager >= 2.17.24
 Requires:       yast2-pkg-bindings >= 2.17.25
-# Y2Storage::Mountable#preferred_mount_by
-Requires:       yast2-storage-ng >= 4.2.90
+# Y2Storage::Mountable#mount_path
+Requires:       yast2-storage-ng >= 4.0.90
 # Support for multiple values in GRUB_TERMINAL
 Requires:       rubygem(%rb_default_ruby_abi:cfa_grub2) >= 1.0.1
 # lenses are needed as cfa_grub2 depends only on augeas bindings, but also
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.2.18/src/lib/bootloader/udev_mapping.rb 
new/yast2-bootloader-4.2.20/src/lib/bootloader/udev_mapping.rb
--- old/yast2-bootloader-4.2.18/src/lib/bootloader/udev_mapping.rb      
2020-03-24 11:32:12.000000000 +0100
+++ new/yast2-bootloader-4.2.20/src/lib/bootloader/udev_mapping.rb      
2020-03-27 09:42:09.000000000 +0100
@@ -38,10 +38,26 @@
 
     # Converts udev or kernel device (disk or partition) to udev name that 
fits best.
     #
-    # The strategy to discover the best mount by option when the device is not 
mounted is delegated
-    # to storage-ng, see Y2Storage::Mountable#preferred_mount_by.
+    # Here is description of strategy for finding the best possible udev 
persistent name.
+    # There are three scenarios we consider:
+    # S1. disk with boot configuration is moved to different PC
+    # S2. disk dies and its content is loaded to new disk from backup
+    # S3. path to disk dies and disk is moved to different one
+    #
+    # Strategy is:
+    #
+    # 1. if device have filesystem and it have its mount_by, then respect it
+    # 2. if there is by-label use it, as it allows to handle S1, S2 and S3 
just with using same
+    #    label
+    # 3. if there is by-uuid then use it as it can also handle S1, S2 and S3 
as uuid can be
+    #    changed, but it is harder to do
+    # 4. if there is by-id use it, as it can handle S3 in some scenarios, but 
not always.
+    # 5. if there is by-path use it as it is last supported udev symlink that 
at least prevent
+    #    change of kernel device during boot
+    # 6. as fallback use kernel name
     #
     # @param dev [String] device udev or kernel one like /dev/disk/by-id/blabla
+    # @raise when device have udev format but do not exists
     # @return [String] udev name
     def to_mountby_device(dev)
       kernel_dev = to_kernel_device(dev)
@@ -76,14 +92,6 @@
       device.name
     end
 
-    # Udev name for the device
-    #
-    # The selected udev name depends on the mount by option. In case of an 
unmounted device,
-    # storage-ng has logic to discover the preferred mount by option.
-    #
-    # @see #to_mountby_device
-    #
-    # @return [String]
     def kernel_to_udev(dev)
       device = Y2Storage::BlkDevice.find_by_name(staging, dev)
       if device.nil?
@@ -91,22 +99,54 @@
         return dev
       end
 
-      udev = mount_by_udev(device) || device.name
-      log.info "udev device for #{dev.inspect} is #{udev.inspect}"
+      result = udev_name_for(device)
+      log.info "udev device for #{dev.inspect} is #{result.inspect}"
+
+      result
+    end
 
-      udev
+    # picks udev name according to strategy
+    # @see #to_mountby_device
+    def udev_name_for(device)
+      mount_by_udev(device) ||
+        udev_by_label(device) ||
+        udev_by_uuid(device) ||
+        udev_by_id(device) ||
+        udev_by_path(device) ||
+        device.name
     end
 
-    # @return [String, nil] nil if the udev name cannot be found
     def mount_by_udev(device)
       filesystem = device.filesystem
       return nil unless filesystem
+      # mount_by is nil, so not mounted and we need to use our own strategy
+      return nil if filesystem.mount_by.nil?
 
-      # If the device is not mounted, a preferred mount by option is 
calculated.
-      mount_by = filesystem.mount_by || filesystem.preferred_mount_by
-      return nil unless mount_by
+      case filesystem.mount_by.to_sym
+      when :device then device.name
+      when :uuid then udev_by_uuid(device)
+      when :label then udev_by_label(device)
+      when :id then udev_by_id(device)
+      when :path then udev_by_path(device)
+      else
+        raise "Unknown mount by option #{filesystem.mount_by.inspect} for 
#{filesystem.inspect}"
+      end
+    end
+
+    def udev_by_uuid(device)
+      device.udev_full_uuid
+    end
+
+    def udev_by_label(device)
+      device.udev_full_label
+    end
+
+    def udev_by_id(device)
+      device.udev_full_ids.first
+    end
 
-      device.path_for_mount_by(mount_by)
+    def udev_by_path(device)
+      device.udev_full_paths.first
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.2.18/test/udev_mapping_test.rb 
new/yast2-bootloader-4.2.20/test/udev_mapping_test.rb
--- old/yast2-bootloader-4.2.18/test/udev_mapping_test.rb       2020-03-24 
11:32:12.000000000 +0100
+++ new/yast2-bootloader-4.2.20/test/udev_mapping_test.rb       2020-03-27 
09:42:09.000000000 +0100
@@ -42,66 +42,56 @@
   end
 
   describe ".to_mountby_device" do
+    let(:device) { find_device("/dev/sda3") }
+
     before do
       # find by name creates always new instance, so to make mocking easier, 
mock it to return always same instance
       allow(Y2Storage::BlkDevice).to receive(:find_by_name).and_return(device)
-
-      allow(device).to 
receive(:path_for_mount_by).with(mount_by).and_return(udev_name)
     end
 
-    let(:device) { find_device("/dev/sda3") }
-
-    let(:mount_by) { Y2Storage::Filesystems::MountByType.new(mount_by_option) }
-
-    context "when the device is mounted" do
-      before do
-        device.filesystem.mount_point.mount_by = mount_by
-      end
+    it "returns udev link in same format as used to its mounting" do
+      device.filesystem.mount_point.mount_by = 
Y2Storage::Filesystems::MountByType.new(:uuid)
 
-      let(:mount_by_option) { :label }
+      expect(subject.to_mountby_device(device.name)).to eq 
"/dev/disk/by-uuid/3de29985-8cc6-4c9d-8562-2ede26b0c5b6"
+    end
 
-      context "and the udev name is available for the mount by option in the 
mount point" do
-        let(:udev_name) { "/dev/disk/by-label/test" }
+    it "returns udev link by label if defined" do
+      device.filesystem.remove_mount_point
 
-        it "returns the udev name according to the mount by option in the 
mount point" do
-          expect(subject.to_mountby_device(device.name)).to eq(udev_name)
-        end
-      end
+      expect(subject.to_mountby_device(device.name)).to eq 
"/dev/disk/by-label/DATA"
+    end
 
-      context "and the udev name is not available for the mount by option in 
the mount point" do
-        let(:udev_name) { nil }
+    it "returns udev link by uuid if defined" do
+      device.filesystem.remove_mount_point
+      allow(device).to receive(:udev_full_label).and_return(nil)
 
-        it "returns the kernel name as fallback" do
-          expect(subject.to_mountby_device(device.name)).to eq("/dev/sda3")
-        end
-      end
+      expect(subject.to_mountby_device(device.name)).to eq 
"/dev/disk/by-uuid/3de29985-8cc6-4c9d-8562-2ede26b0c5b6"
     end
 
-    context "when the device is not mounted" do
-      before do
-        device.filesystem&.remove_mount_point
-
-        allow_any_instance_of(Y2Storage::MountPoint).to 
receive(:preferred_mount_by)
-          .and_return(mount_by)
-      end
+    it "returns first udev link by id if defined" do
+      device.filesystem.remove_mount_point
+      allow(device).to receive(:udev_full_label).and_return(nil)
+      allow(device).to receive(:udev_full_uuid).and_return(nil)
+      allow(device).to receive(:udev_ids).and_return(["abc", "cde"])
 
-      let(:mount_by_option) { :label }
+      expect(subject.to_mountby_device(device.name)).to eq 
"/dev/disk/by-id/abc"
+    end
 
-      context "and the udev name is available for the preferred mount by 
option" do
-        let(:udev_name) { "/dev/disk/by-label/test" }
+    it "returns first udev link by path if defined" do
+      device.filesystem.remove_mount_point
+      allow(device).to receive(:udev_full_label).and_return(nil)
+      allow(device).to receive(:udev_full_uuid).and_return(nil)
+      allow(device).to receive(:udev_paths).and_return(["abc", "cde"])
 
-        it "returns the udev name according to the preferred mount by option" 
do
-          expect(subject.to_mountby_device(device.name)).to eq(udev_name)
-        end
-      end
+      expect(subject.to_mountby_device(device.name)).to eq 
"/dev/disk/by-path/abc"
+    end
 
-      context "and the udev name is not available for the preferred mount by 
option" do
-        let(:udev_name) { nil }
+    it "returns kernel name as last fallback" do
+      device.filesystem.remove_mount_point
+      allow(device).to receive(:udev_full_label).and_return(nil)
+      allow(device).to receive(:udev_full_uuid).and_return(nil)
 
-        it "returns the kernel name as fallback" do
-          expect(subject.to_mountby_device(device.name)).to eq("/dev/sda3")
-        end
-      end
+      expect(subject.to_mountby_device(device.name)).to eq device.name
     end
   end
 end


Reply via email to