File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11-------------------------------------------------------------------
2+ Tue Oct 20 15:36:03 UTC 2020 - Stefan Hundhammer <shundhammer@suse.com>
3+
4+ - Added $LIBSTORAGE_IGNORE_PROBE_ERRORS environment variable
5+ to ignore storage probing errors (bsc#1177332)
6+ - 4.3.16
7+ -------------------------------------------------------------------
28Wed Aug 26 10:08:03 UTC 2020 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>
39
410- Unify profile element paths (bsc#1175680).
Original file line number Diff line number Diff line change 1616#
1717
1818Name: yast2-storage-ng
19- Version: 4.3.15
19+ Version: 4.3.16
2020Release: 0
2121Summary: YaST2 - Storage Configuration
2222License: GPL-2.0 -only OR GPL-3.0 -only
Original file line number Diff line number Diff line change @@ -31,6 +31,31 @@ module Callbacks
3131 class Probe < Storage ::ProbeCallbacksV3
3232 include LibstorageCallback
3333
34+ # Callback for libstorage-ng to report an error to the user.
35+ #
36+ # If the $LIBSTORAGE_IGNORE_PROBE_ERRORS environment variable is set,
37+ # this just returns 'true', i.e. the error is ignored.
38+ #
39+ # Otherwise, this displays the error and prompts the user if the error
40+ # should be ignored.
41+ #
42+ # @note If the user rejects to continue, the method will return false
43+ # which implies libstorage-ng will raise the corresponding exception for
44+ # the error.
45+ #
46+ # See Storage::Callbacks#error in libstorage-ng
47+ #
48+ # @param message [String] error title coming from libstorage-ng
49+ # (in the ASCII-8BIT encoding! see https://sourceforge.net/p/swig/feature-requests/89/)
50+ # @param what [String] details coming from libstorage-ng (in the ASCII-8BIT encoding!)
51+ # @return [Boolean] true will make libstorage-ng ignore the error, false
52+ # will result in a libstorage-ng exception
53+ def error ( message , what )
54+ return true if StorageEnv . instance . ignore_probe_errors?
55+
56+ super ( message , what )
57+ end
58+
3459 # Callback for missing commands during probing.
3560 #
3661 # @param message [String] error title coming from libstorage-ng
Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ class StorageEnv
3232
3333 ENV_ACTIVATE_LUKS = "YAST_ACTIVATE_LUKS" . freeze
3434
35+ ENV_LIBSTORAGE_IGNORE_PROBE_ERRORS = "LIBSTORAGE_IGNORE_PROBE_ERRORS" . freeze
36+
3537 private_constant :ENV_MULTIPATH , :ENV_BIOS_RAID , :ENV_ACTIVATE_LUKS
38+ private_constant :ENV_LIBSTORAGE_IGNORE_PROBE_ERRORS
3639
3740 def initialize
3841 @active_cache = { }
@@ -67,6 +70,21 @@ def activate_luks?
6770 active? ( ENV_ACTIVATE_LUKS , true )
6871 end
6972
73+ # Whether errors during libstorage probing should be ignored.
74+ #
75+ # See bsc#1177332:
76+ #
77+ # Some storage technologies like Veritas Volume Manager use disk labels
78+ # like "sun" that we don't support in libstorage / storage-ng. Setting the
79+ # LIBSTORAGE_IGNORE_PROBE_ERRORS env var gives the admin a chance to use
80+ # the YaST partitioner despite that. Those disks will show up like empty
81+ # disks and not cause an error pop-up for each one.
82+ def ignore_probe_errors?
83+ result = active? ( ENV_LIBSTORAGE_IGNORE_PROBE_ERRORS )
84+ log . info ( "Ignoring libstorage probe errors" ) if result
85+ result
86+ end
87+
7088 private
7189
7290 # Whether the env variable is active
Original file line number Diff line number Diff line change 2828 describe "#error" do
2929 include_examples "general #error examples"
3030 include_examples "default #error true examples"
31+
32+ context "without LIBSTORAGE_IGNORE_PROBE_ERRORS" do
33+ before { mock_env ( env_vars ) }
34+ let ( :env_vars ) { { } }
35+ it "it displays an error pop-up" do
36+ expect ( Yast ::Report ) . to receive ( :yesno_popup )
37+ subject . error ( "probing failed" , "" )
38+ end
39+ end
40+
41+ context "with LIBSTORAGE_IGNORE_PROBE_ERRORS set" do
42+ before { mock_env ( env_vars ) }
43+ after { mock_env ( { } ) } # clean up for future tests
44+ let ( :env_vars ) { { "LIBSTORAGE_IGNORE_PROBE_ERRORS" => "1" } }
45+ it "does not display an error pop-up and returns true" do
46+ expect ( Yast ::Report ) . not_to receive ( :yesno_popup )
47+ expect ( subject . error ( "probing failed" , "" ) ) . to be true
48+ end
49+ end
3150 end
3251
3352 describe "#begin" do
You can’t perform that action at this time.
0 commit comments