From aa89273a3b39667623fb28cb02ed0fe0ee936e5a Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 18 Jul 2023 17:03:04 +0200 Subject: [PATCH 1/2] iscsi: Allow changing iSCSI initiator name once set Blivet (and UDisks) now allow changing of the initiator name which can now be changed unless an active session already exists. --- pyanaconda/modules/storage/iscsi/iscsi.py | 7 ++++--- pyanaconda/modules/storage/iscsi/iscsi_interface.py | 6 +----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pyanaconda/modules/storage/iscsi/iscsi.py b/pyanaconda/modules/storage/iscsi/iscsi.py index f54da3cf883..10c676e133b 100644 --- a/pyanaconda/modules/storage/iscsi/iscsi.py +++ b/pyanaconda/modules/storage/iscsi/iscsi.py @@ -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) @@ -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. diff --git a/pyanaconda/modules/storage/iscsi/iscsi_interface.py b/pyanaconda/modules/storage/iscsi/iscsi_interface.py index daff91f40d1..23758134a57 100644 --- a/pyanaconda/modules/storage/iscsi/iscsi_interface.py +++ b/pyanaconda/modules/storage/iscsi/iscsi_interface.py @@ -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() From a05f6c9e9a5090540178205676405874e8ef7b12 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Thu, 3 Aug 2023 11:55:39 +0200 Subject: [PATCH 2/2] spec: Bump required blivet version to 3.8.1 This version added support for the iSCSI initiator name change. --- anaconda.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anaconda.spec.in b/anaconda.spec.in index 75115d61a79..9df04c657dd 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -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