Skip to content

Commit

Permalink
Merge pull request #4935 from vojtechtrefny/master_iscsi-initiatornam…
Browse files Browse the repository at this point in the history
…e-change

iscsi: Allow changing iSCSI initiator name once set
  • Loading branch information
vojtechtrefny authored Aug 7, 2023
2 parents 0ec408e + a05f6c9 commit d70c1fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion anaconda.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Source0: https://github.com/rhinstaller/%{name}/releases/download/%{name}-%{vers
%define nmver 1.0
%define pykickstartver 3.47-1
%define pypartedver 2.5-2
%define pythonblivetver 1:3.7.1-4
%define pythonblivetver 1:3.8.1-1
%define rpmver 4.15.0
%define simplelinever 1.9.0-1
%define subscriptionmanagerver 1.26
Expand Down
7 changes: 4 additions & 3 deletions pyanaconda/modules/storage/iscsi/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def set_initiator(self, initiator):
:param initiator: a name of the initiator
"""
if not iscsi.initiator_set:
if not iscsi.initiator_set or (initiator != iscsi.initiator and self.can_set_initiator()):
iscsi.initiator = initiator
self.initiator_changed.emit()
log.debug("The iSCSI initiator is set to '%s'.", initiator)
Expand All @@ -79,9 +79,10 @@ def set_initiator(self, initiator):
def can_set_initiator(self):
"""Can the initiator be set?
Once the initiator name is set it can't be changed.
Initiator name can be changed when no sessions are active.
"""
return not iscsi.initiator_set
active = iscsi._get_active_sessions()
return not active

def get_interface_mode(self):
"""Get the mode of interfaces used for iSCSI operations.
Expand Down
6 changes: 1 addition & 5 deletions pyanaconda/modules/storage/iscsi/iscsi_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ def Initiator(self, initiator: Str):
def CanSetInitiator(self) -> Bool:
"""Can the iSCSI initator be set?
Once the initiator name is set it can't be changed.
FIXME
Investigate if it needs to be so strict? Perhaps it has to be frozen only
once there are active nodes logged in, or once any nodes were discovered.
This would need to be changed in blivet/iscsi.py.
Initiator name can be changed when no sessions are active.
"""
return self.implementation.can_set_initiator()

Expand Down

0 comments on commit d70c1fc

Please sign in to comment.