Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iscsi: Allow changing iSCSI initiator name once set #4933

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -70,11 +70,7 @@ def SetInitiator(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
Loading