Skip to content

Commit

Permalink
Merge pull request #138 from yast/merge_SLE-15-SP7
Browse files Browse the repository at this point in the history
Use iscsi ifaces instead of offload card (bsc#1231385) - master
  • Loading branch information
teclator authored Nov 12, 2024
2 parents cb66ef2 + 533bab6 commit 59f0cb0
Show file tree
Hide file tree
Showing 9 changed files with 367 additions and 610 deletions.
9 changes: 9 additions & 0 deletions package/yast2-iscsi-client.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Oct 31 11:46:26 UTC 2024 - Knut Anderssen <[email protected]>

- Fixes for bsc#1231385
- Do not call iscsi_offload.sh script anymore using the iscsi
ifaces created by autoLogOn directly and exposing them in the
UI instead of the offload card selection.
- 5.0.4

-------------------------------------------------------------------
Fri Sep 27 14:37:24 UTC 2024 - Knut Anderssen <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-iscsi-client.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-iscsi-client
Version: 5.0.3
Version: 5.0.4
Release: 0
Summary: YaST2 - iSCSI Client Configuration
License: GPL-2.0-only
Expand Down
5 changes: 3 additions & 2 deletions src/clients/inst_iscsi-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ def main
)
# check initiator name, create if not exists
IscsiClientLib.checkInitiatorName

IscsiClientLib.getiBFT
IscsiClientLib.LoadOffloadModules
IscsiClientLib.getiBFT

# try auto login to target
auto_login = IscsiClientLib.autoLogOn
# force a read of ifaces
IscsiClientLib.read_ifaces if auto_login
# force a read of sessions in case of auto_login (bsc#1228084)
IscsiClientLib.readSessions if auto_login

Expand Down
15 changes: 6 additions & 9 deletions src/include/iscsi-client/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,16 @@ def widgets
"widget" => :custom,
"custom_widget" => HBox(
MinWidth(
16,
72,
HBox(
# name of iscsi client (/etc/iscsi/initiatorname.iscsi)
TextEntry(Id(:initiator_name), _("&Initiator Name")),
MinWidth(
8,
36,
ComboBox(
Id(:offload_card),
Id(:iface),
Opt(:notify),
# prefer to not translate 'Offload' unless there is a well
# known word for this technology (it's special hardware
# shifting load from processor to card)
_("Offload Car&d"),
_("iSCSI I&face"),
[]
)
)
Expand All @@ -113,10 +110,10 @@ def widgets
"symbol (string, map)"
),
"handle" => fun_ref(
method(:handleOffload),
method(:handleIface),
"symbol (string, map)"
),
"help" => Ops.get_string(@HELPS, "initiator_name", "")
"help" => @HELPS["initiator_name"].to_s
},
# table of connected targets
"connected_table" => {
Expand Down
5 changes: 4 additions & 1 deletion src/include/iscsi-client/helps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def initialize_iscsi_client_helps(_include_target)
),
"initiator_name" => _(
"<p><b>Initiator Name</b> is a value from <tt>/etc/iscsi/initiatorname.iscsi</tt>. \nIn case you have iBFT, this value will be added from there and you are only able to change it in the BIOS setup.</p>"
),
) +
_(
"<p><b>iSCSI Iface</b> allows to select an specific iSCSI iface to be used for discovering targets.</p>"
),
"isns" => _(
"If you want to use <b>iSNS</b> (Internet Storage Name Service) for discovering targets instead of the default SendTargets method,\nfill in the IP address of the iSNS server and port. The default port should be 3205.\n"
),
Expand Down
50 changes: 17 additions & 33 deletions src/include/iscsi-client/widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

module Yast
module IscsiClientWidgetsInclude
include Logger

def initialize_iscsi_client_widgets(_include_target)
textdomain "iscsi-client"
Yast.import "IP"
Expand Down Expand Up @@ -227,15 +229,10 @@ def storeISNS(_key, event)
def initInitName(_key)
Builtins.y2milestone("initiatorname %1", IscsiClientLib.initiatorname)
UI.ChangeWidget(:initiator_name, :Value, IscsiClientLib.initiatorname)
UI.ChangeWidget(:offload_card, :Items, IscsiClientLib.GetOffloadItems)
UI.ChangeWidget(:offload_card, :Value, IscsiClientLib.GetOffloadCard)
Builtins.y2milestone("OffloadCard %1", IscsiClientLib.GetOffloadCard)
if Ops.greater_than(
Builtins.size(
Ops.get_string(IscsiClientLib.getiBFT, "iSCSI_INITIATOR_NAME", "")
),
0
)
UI.ChangeWidget(:iface, :Items, IscsiClientLib.iface_items)
UI.ChangeWidget(:iface, :Value, IscsiClientLib.selected_iface)
log.info "Selected Iface: #{IscsiClientLib.selected_iface}"
unless IscsiClientLib.getiBFT["iSCSI_INITIATOR_NAME"].to_s.empty?
UI.ChangeWidget(:initiator_name, :Enabled, false)
# Not sure if there is such a widget called :write
UI.ChangeWidget(:write, :Enabled, false)
Expand Down Expand Up @@ -290,6 +287,10 @@ def validateInitName(_key, event)
end
end

def iface_value
UI.QueryWidget(:iface, :Value).to_s
end

def storeInitName(_key, event)
event = deep_copy(event)
if Convert.to_string(UI.QueryWidget(:initiator_name, :Value)) !=
Expand All @@ -304,34 +305,17 @@ def storeInitName(_key, event)
else
Service.Restart("iscsid")
end
Builtins.y2milestone(
"write initiatorname %1",
IscsiClientLib.initiatorname
)
end
if Convert.to_string(UI.QueryWidget(:offload_card, :Value)) !=
IscsiClientLib.GetOffloadCard
IscsiClientLib.SetOffloadCard(
Convert.to_string(UI.QueryWidget(:offload_card, :Value))
)
Builtins.y2milestone("OffloadCard %1", IscsiClientLib.GetOffloadCard)
log.info "write initiatorname #{IscsientLib.initiatorname}"
end
IscsiClientLib.iface = iface_value if iface_value != IscsiClientLib.selected_iface
nil
end

def handleOffload(_key, event)
event = deep_copy(event)
if event["EventReason"] || "" == "ValueChanged" &&
event["ID"] || :none == :offload_card
if Convert.to_string(UI.QueryWidget(:offload_card, :Value)) !=
IscsiClientLib.GetOffloadCard
IscsiClientLib.SetOffloadCard(
Convert.to_string(UI.QueryWidget(:offload_card, :Value))
)
Builtins.y2milestone(
"handleOffload OffloadCard %1",
IscsiClientLib.GetOffloadCard
)
def handleIface(_key, event)
if event["EventReason"].to_s == "ValueChanged" && event["ID"] == :iface
if iface_value != IscsiClientLib.selected_iface
IscsiClientLib.iface = iface_value
log.info "handleIface iface: #{IscsiClientLib.selected_iface}"
end
end
nil
Expand Down
Loading

0 comments on commit 59f0cb0

Please sign in to comment.