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 #4935

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
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
vojtechtrefny marked this conversation as resolved.
Show resolved Hide resolved
%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