diff --git a/doc/dbus/bus/org.opensuse.Agama.Storage1.ZFCP.Controller.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Storage1.ZFCP.Controller.bus.xml
index 57c087a7e7..1d8359139f 100644
--- a/doc/dbus/bus/org.opensuse.Agama.Storage1.ZFCP.Controller.bus.xml
+++ b/doc/dbus/bus/org.opensuse.Agama.Storage1.ZFCP.Controller.bus.xml
@@ -49,6 +49,7 @@
+
diff --git a/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml
index 8eb8f5c99d..5648db817b 100644
--- a/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml
+++ b/doc/dbus/bus/org.opensuse.Agama.Storage1.bus.xml
@@ -1,6 +1,8 @@
+
+
@@ -109,5 +111,6 @@
+
diff --git a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml
index 2b988c2833..04e45a262b 100644
--- a/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml
+++ b/doc/dbus/org.opensuse.Agama.Storage1.ZFCP.Controller.doc.xml
@@ -79,6 +79,10 @@
Whether the controller is active.
-->
+
+
diff --git a/doc/dbus/org.opensuse.Agama.Storage1.doc.xml b/doc/dbus/org.opensuse.Agama.Storage1.doc.xml
index c36caed77e..83cbc012bb 100644
--- a/doc/dbus/org.opensuse.Agama.Storage1.doc.xml
+++ b/doc/dbus/org.opensuse.Agama.Storage1.doc.xml
@@ -26,5 +26,9 @@
-->
+
+
diff --git a/service/Gemfile.lock b/service/Gemfile.lock
index 9968f62ffb..fc39b5c099 100644
--- a/service/Gemfile.lock
+++ b/service/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- agama (2.1)
+ agama (2.1.devel317)
cfa (~> 1.0.2)
cfa_grub2 (~> 2.0.0)
cheetah (~> 1.0.0)
@@ -26,13 +26,13 @@ GEM
docile (1.4.0)
eventmachine (1.2.7)
fast_gettext (2.2.0)
- mini_portile2 (2.8.1)
+ mini_portile2 (2.8.2)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
packaging_rake_tasks (1.5.1)
rake
- racc (1.6.2)
+ racc (1.7.1)
rake (13.0.6)
rexml (3.2.5)
rspec (3.11.0)
diff --git a/service/lib/agama/dbus/storage/interfaces/zfcp_manager.rb b/service/lib/agama/dbus/storage/interfaces/zfcp_manager.rb
index 939eb4fdb7..f909c1741e 100644
--- a/service/lib/agama/dbus/storage/interfaces/zfcp_manager.rb
+++ b/service/lib/agama/dbus/storage/interfaces/zfcp_manager.rb
@@ -31,6 +31,13 @@ module Interfaces
#
# @note This mixin is expected to be included by {Agama::DBus::Storage::Manager}.
module ZFCPManager
+ # Whether the option for allowing automatic LUN scan is active
+ #
+ # @return [Boolean]
+ def allow_lun_scan
+ zfcp_backend.allow_lun_scan?
+ end
+
# Registers callbacks to update the collection of zFCP controllers, the disks and
# deprecate the system
def register_zfcp_callbacks
@@ -71,6 +78,9 @@ def zfcp_backend
def self.included(base)
base.class_eval do
dbus_interface ZFCP_MANAGER_INTERFACE do
+ # @see #allow_lun_scan
+ dbus_reader(:allow_lun_scan, "b", dbus_name: "AllowLUNScan")
+
# Probes the zFCP controllers and disks
dbus_method(:Probe) do
busy_while { zfcp_backend.probe }
diff --git a/service/lib/agama/dbus/storage/zfcp_controller.rb b/service/lib/agama/dbus/storage/zfcp_controller.rb
index 6097b03abd..1ed8f6906d 100644
--- a/service/lib/agama/dbus/storage/zfcp_controller.rb
+++ b/service/lib/agama/dbus/storage/zfcp_controller.rb
@@ -55,6 +55,13 @@ def active
controller.active?
end
+ # Whether the controller is automatically scanning LUNs
+ #
+ # @return [Boolean]
+ def lun_scan
+ controller.lun_scan?
+ end
+
# zFCP channel id
#
# @return [String]
@@ -132,6 +139,9 @@ def controller=(value)
# @see #active
dbus_reader(:active, "b")
+ # @see #lun_scan
+ dbus_reader(:lun_scan, "b", dbus_name: "LUNScan")
+
# @see #channel
dbus_reader(:channel, "s")
diff --git a/service/lib/agama/storage/zfcp/controller.rb b/service/lib/agama/storage/zfcp/controller.rb
index 07fa3bb1ae..0d67e40b83 100644
--- a/service/lib/agama/storage/zfcp/controller.rb
+++ b/service/lib/agama/storage/zfcp/controller.rb
@@ -33,9 +33,16 @@ class Controller
# @return [String]
attr_reader :channel
+ # @see #active?
+ #
# @return [Boolean]
attr_writer :active
+ # @see #lun_scan?
+ #
+ # @return [Boolean]
+ attr_writer :lun_scan
+
eql_attr :channel, :active?
# Constructor
@@ -51,6 +58,13 @@ def initialize(channel)
def active?
!!@active
end
+
+ # Whether the controller is automatically scanning LUNs
+ #
+ # @return [Booelan]
+ def lun_scan?
+ !!@lun_scan
+ end
end
end
end
diff --git a/service/lib/agama/storage/zfcp/manager.rb b/service/lib/agama/storage/zfcp/manager.rb
index 0a13c89a2a..0fd8f8ff22 100644
--- a/service/lib/agama/storage/zfcp/manager.rb
+++ b/service/lib/agama/storage/zfcp/manager.rb
@@ -78,6 +78,17 @@ def disks
yast_zfcp.disks.map { |d| disk_from(d) }
end
+ # Whether the option for allowing automatic LUN scan (allow_lun_scan) 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?
+ yast_zfcp.allow_lun_scan?
+ end
+
# Activates the controller with the given channel id
#
# @note: If "allow_lun_scan" is active, then all LUNs are automatically activated.
@@ -161,6 +172,7 @@ def update_disks
def controller_from(record)
Controller.new(record["sysfs_bus_id"]).tap do |controller|
controller.active = yast_zfcp.activated_controller?(controller.channel)
+ controller.lun_scan = yast_zfcp.lun_scan_controller?(controller.channel)
end
end
diff --git a/service/package/gem2rpm.yml b/service/package/gem2rpm.yml
index 018cb6b64a..64544c3545 100644
--- a/service/package/gem2rpm.yml
+++ b/service/package/gem2rpm.yml
@@ -27,7 +27,7 @@
# yast2 with ArchFilter
Requires: yast2 >= 4.5.20
%ifarch s390 s390x
- Requires: yast2-s390 >= 4.6.2
+ Requires: yast2-s390 >= 4.6.3
%endif
:filelist: "%{_datadir}/dbus-1/agama.conf\n
%dir %{_datadir}/dbus-1/agama-services\n
diff --git a/service/package/rubygem-agama.changes b/service/package/rubygem-agama.changes
index 5c94d85ab1..1269fd80a1 100644
--- a/service/package/rubygem-agama.changes
+++ b/service/package/rubygem-agama.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Wed Jun 14 15:11:56 UTC 2023 - José Iván López González
+
+- Extend zFCP D-Bus API to provide allow_lun_scan info
+ (gh#openSUSE/agama/626).
+
-------------------------------------------------------------------
Wed Jun 7 11:13:49 UTC 2023 - José Iván López González
diff --git a/service/test/agama/dbus/storage/zfcp_controller_test.rb b/service/test/agama/dbus/storage/zfcp_controller_test.rb
index a671ba4c9d..cd3936cd78 100644
--- a/service/test/agama/dbus/storage/zfcp_controller_test.rb
+++ b/service/test/agama/dbus/storage/zfcp_controller_test.rb
@@ -61,6 +61,28 @@
end
end
+ describe "#lun_scan" do
+ before do
+ controller1.lun_scan = lun_scan
+ end
+
+ context "if the controller is automatically scanning LUNs" do
+ let(:lun_scan) { true }
+
+ it "returns true" do
+ expect(subject.lun_scan).to eq(true)
+ end
+ end
+
+ context "if the controller is not automatically scanning LUNs" do
+ let(:lun_scan) { false }
+
+ it "returns false" do
+ expect(subject.lun_scan).to eq(false)
+ end
+ end
+ end
+
describe "#channel" do
it "returns the channel id of the controller" do
expect(subject.channel).to eq("0.0.fa00")
diff --git a/service/test/agama/storage/zfcp/manager_test.rb b/service/test/agama/storage/zfcp/manager_test.rb
index 461f1a1f50..7ca8d6866a 100644
--- a/service/test/agama/storage/zfcp/manager_test.rb
+++ b/service/test/agama/storage/zfcp/manager_test.rb
@@ -108,7 +108,10 @@ module Y2S390
before do
allow(yast_zfcp).to receive(:activated_controller?).with("0.0.fa00").and_return(true)
+ allow(yast_zfcp).to receive(:lun_scan_controller?).with("0.0.fa00").and_return(true)
+
allow(yast_zfcp).to receive(:activated_controller?).with("0.0.fc00").and_return(false)
+ allow(yast_zfcp).to receive(:lun_scan_controller?).with("0.0.fc00").and_return(false)
end
it "returns the zFCP controllers" do
@@ -118,9 +121,11 @@ module Y2S390
controller = controllers.find { |c| c.channel == "0.0.fa00" }
expect(controller.active?).to eq(true)
+ expect(controller.lun_scan?).to eq(true)
controller = controllers.find { |c| c.channel == "0.0.fc00" }
expect(controller.active?).to eq(false)
+ expect(controller.lun_scan?).to eq(false)
end
end
@@ -149,6 +154,28 @@ module Y2S390
end
end
+ describe "#allow_lun_scan?" do
+ before do
+ allow(yast_zfcp).to receive(:allow_lun_scan?).and_return(active)
+ end
+
+ context "if allow_lun_scan is active" do
+ let(:active) { true }
+
+ it "returns true" do
+ expect(subject.allow_lun_scan?).to eq(true)
+ end
+ end
+
+ context "if allow_lun_scan is not active" do
+ let(:active) { false }
+
+ it "returns false" do
+ expect(subject.allow_lun_scan?).to eq(false)
+ end
+ end
+ end
+
describe "#activate_controller" do
before do
allow(yast_zfcp).to receive(:activate_controller).and_return(output)