Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-s390 for openSUSE:Factory 
checked in at 2023-06-16 16:55:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-s390 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-s390.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-s390"

Fri Jun 16 16:55:41 2023 rev:32 rq:1093465 version:4.6.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-s390/yast2-s390.changes    2023-06-09 
20:43:31.304674130 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-s390.new.15902/yast2-s390.changes 
2023-06-16 16:56:45.266383585 +0200
@@ -1,0 +2,7 @@
+Wed Jun 14 14:38:18 UTC 2023 - José Iván López González <jlo...@suse.com>
+
+- Add info about allow_lun_scan option (related to
+  gh#openSUSE/agama#626).
+- 4.6.3
+
+-------------------------------------------------------------------

Old:
----
  yast2-s390-4.6.2.tar.bz2

New:
----
  yast2-s390-4.6.3.tar.bz2

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

Other differences:
------------------
++++++ yast2-s390.spec ++++++
--- /var/tmp/diff_new_pack.dOAUdV/_old  2023-06-16 16:56:45.902387337 +0200
+++ /var/tmp/diff_new_pack.dOAUdV/_new  2023-06-16 16:56:45.906387362 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-s390
-Version:        4.6.2
+Version:        4.6.3
 Release:        0
 Group:          System/YaST
 License:        GPL-2.0-only

++++++ yast2-s390-4.6.2.tar.bz2 -> yast2-s390-4.6.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.6.2/package/yast2-s390.changes 
new/yast2-s390-4.6.3/package/yast2-s390.changes
--- old/yast2-s390-4.6.2/package/yast2-s390.changes     2023-06-09 
11:19:12.000000000 +0200
+++ new/yast2-s390-4.6.3/package/yast2-s390.changes     2023-06-16 
11:42:50.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Jun 14 14:38:18 UTC 2023 - José Iván López González <jlo...@suse.com>
+
+- Add info about allow_lun_scan option (related to
+  gh#openSUSE/agama#626).
+- 4.6.3
+
+-------------------------------------------------------------------
 Mon Jun  5 10:09:02 UTC 2023 - José Iván López González <jlo...@suse.com>
 
 - Expose zFCP core functionallity (related to
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.6.2/package/yast2-s390.spec 
new/yast2-s390-4.6.3/package/yast2-s390.spec
--- old/yast2-s390-4.6.2/package/yast2-s390.spec        2023-06-09 
11:19:12.000000000 +0200
+++ new/yast2-s390-4.6.3/package/yast2-s390.spec        2023-06-16 
11:42:50.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-s390
-Version:        4.6.2
+Version:        4.6.3
 Release:        0
 Group:          System/YaST
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.6.2/src/lib/y2s390/zfcp.rb 
new/yast2-s390-4.6.3/src/lib/y2s390/zfcp.rb
--- old/yast2-s390-4.6.2/src/lib/y2s390/zfcp.rb 2023-06-09 11:19:12.000000000 
+0200
+++ new/yast2-s390-4.6.3/src/lib/y2s390/zfcp.rb 2023-06-16 11:42:50.000000000 
+0200
@@ -22,10 +22,19 @@
 
 module Y2S390
   # Manager for zFCP devices
+  #
+  # About allow_lun_scan option:
+  #   * It is enabled by default since SLE 12.
+  #   * It can be disabled by means of a kernel parameter 
(zfcp.allow_lun_scan=0).
+  #   * Configuring it once the system boots is discouraged, see
+  #     https://bugzilla.suse.com/show_bug.cgi?id=1210597#c20
   class ZFCP
     include Yast
     include Yast::Logger
 
+    ALLOW_LUN_SCAN_FILE = "/sys/module/zfcp/parameters/allow_lun_scan".freeze
+    private_constant :ALLOW_LUN_SCAN_FILE
+
     # Detected controllers
     #
     # @return [Array<Hash>] keys for each hash:
@@ -43,6 +52,20 @@
       @disks = []
     end
 
+    # Whether the allow_lun_scan option is active
+    #
+    # Having allow_lun_scan active has some implications:
+    #   * All LUNs are automatically activated when the controller is 
activated.
+    #   * LUNs cannot be deactivated.
+    #
+    # @return [Boolean]
+    def allow_lun_scan?
+      return false unless File.exist?(ALLOW_LUN_SCAN_FILE)
+
+      allow = Yast::SCR.Read(path(".target.string"), ALLOW_LUN_SCAN_FILE).chomp
+      allow == "Y"
+    end
+
     # Probes the zFCP controllers
     def probe_controllers
       make_all_devices_visible
@@ -90,6 +113,20 @@
       io.any? { |i| i["active"] }
     end
 
+    # Whether the controller is performing auto LUN scan
+    #
+    # For that, allow_lun_scan must be active and the controller must be 
running in NPIV mode.
+    #
+    # @param channel [String] E.g., "0.0.fa00"
+    # @return [Boolean]
+    def lun_scan_controller?(channel)
+      file = 
"/sys/bus/ccw/drivers/zfcp/#{channel}/host0/fc_host/host0/port_type"
+      return false unless allow_lun_scan? && File.exist?(file)
+
+      mode = Yast::SCR.Read(path(".target.string"), file).chomp
+      mode == "NPIV VPORT"
+    end
+
     # Runs the command for activating a zFCP disk
     #
     # @param channel [String] E.g., "0.0.fa00"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.6.2/test/y2s390/zfcp_test.rb 
new/yast2-s390-4.6.3/test/y2s390/zfcp_test.rb
--- old/yast2-s390-4.6.2/test/y2s390/zfcp_test.rb       2023-06-09 
11:19:12.000000000 +0200
+++ new/yast2-s390-4.6.3/test/y2s390/zfcp_test.rb       2023-06-16 
11:42:50.000000000 +0200
@@ -23,6 +23,34 @@
 require "y2s390/zfcp"
 
 describe Y2S390::ZFCP do
+  describe "#allow_lun_scan?" do
+    before do
+      allow(File).to receive(:exist?)
+        .with("/sys/module/zfcp/parameters/allow_lun_scan")
+        .and_return(true)
+
+      allow(Yast::SCR).to receive(:Read)
+        .with(anything, "/sys/module/zfcp/parameters/allow_lun_scan")
+        .and_return(allow_lun_scan)
+    end
+
+    context "if allow_lun_scan is active" do
+      let(:allow_lun_scan) { "Y" }
+
+      it "returns true" do
+        expect(subject.allow_lun_scan?).to eq(true)
+      end
+    end
+
+    context "if allow_lun_scan is not active" do
+      let(:allow_lun_scan) { "N" }
+
+      it "returns false" do
+        expect(subject.allow_lun_scan?).to eq(false)
+      end
+    end
+  end
+
   describe "#probe_controllers" do
     before do
       allow(Yast::SCR).to receive(:Read).with(Yast.path(".probe.storage"))
@@ -143,6 +171,70 @@
       end
     end
   end
+
+  describe "#lun_scan_controller?" do
+    before do
+      allow(subject).to receive(:allow_lun_scan?).and_return(allow_lun_scan)
+
+      allow(Yast::SCR).to receive(:Read)
+        .with(anything, "/sys/module/zfcp/parameters/allow_lun_scan")
+        .and_return(allow_lun_scan)
+
+      allow(File).to receive(:exist?)
+        
.with("/sys/bus/ccw/drivers/zfcp/0.0.fa00/host0/fc_host/host0/port_type")
+        .and_return(controller_active)
+
+      allow(Yast::SCR).to receive(:Read)
+        .with(anything, 
"/sys/bus/ccw/drivers/zfcp/0.0.fa00/host0/fc_host/host0/port_type")
+        .and_return(controller_mode)
+    end
+
+    let(:allow_lun_scan) { nil }
+
+    let(:controller_active) { nil }
+
+    let(:controller_mode) { nil }
+
+    context "if allow_lun_scan is not active" do
+      let(:allow_lun_scan) { false }
+
+      it "returns false" do
+        expect(subject.lun_scan_controller?("0.0.fa00")).to eq(false)
+      end
+    end
+
+    context "if allow_lun_scan is active and the controller is not active" do
+      let(:allow_lun_scan) { true }
+
+      let(:controller_active) { false }
+
+      it "returns false" do
+        expect(subject.lun_scan_controller?("0.0.fa00")).to eq(false)
+      end
+    end
+
+    context "if allow_lun_scan is active and the controller is active" do
+      let(:allow_lun_scan) { true }
+
+      let(:controller_active) { true }
+
+      context "and the controller is not running in NPIV mode" do
+        let(:controller_mode) { "" }
+
+        it "returns false" do
+          expect(subject.lun_scan_controller?("0.0.fa00")).to eq(false)
+        end
+      end
+
+      context "and the controller is running in NPIV mode" do
+        let(:controller_mode) { "NPIV VPORT" }
+
+        it "returns true" do
+          expect(subject.lun_scan_controller?("0.0.fa00")).to eq(true)
+        end
+      end
+    end
+  end
 
   describe "#activate_disk" do
     before do

Reply via email to