|
|
6903c7 |
From fbe970add68e6d9d998fb7f78377368c403e200d Mon Sep 17 00:00:00 2001
|
|
|
6903c7 |
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
|
6903c7 |
Date: Mon, 31 Oct 2022 15:15:31 +0100
|
|
|
6903c7 |
Subject: [PATCH] tests: Restart iscsid on every InitiatorName change
|
|
|
6903c7 |
|
|
|
6903c7 |
The test LIO target config expects a specific initiator name as set
|
|
|
6903c7 |
by the ACLs. However the iscsid daemon only seems to be reading
|
|
|
6903c7 |
the InitiatorName string on startup and in case the service is running
|
|
|
6903c7 |
with a different name, the auth tests will fail.
|
|
|
6903c7 |
|
|
|
6903c7 |
As a workaround, restart the iscsid service after each change.
|
|
|
6903c7 |
A proper way through libiscsi or libopeniscsiusr would be nice -> TODO.
|
|
|
6903c7 |
---
|
|
|
6903c7 |
src/tests/dbus-tests/test_30_iscsi.py | 12 ++++++++++++
|
|
|
6903c7 |
1 file changed, 12 insertions(+)
|
|
|
6903c7 |
|
|
|
6903c7 |
diff --git a/src/tests/dbus-tests/test_30_iscsi.py b/src/tests/dbus-tests/test_30_iscsi.py
|
|
|
6903c7 |
index f2594d992..09e975f30 100644
|
|
|
6903c7 |
--- a/src/tests/dbus-tests/test_30_iscsi.py
|
|
|
6903c7 |
+++ b/src/tests/dbus-tests/test_30_iscsi.py
|
|
|
6903c7 |
@@ -48,9 +48,21 @@ def _force_lougout(self, target):
|
|
|
6903c7 |
def _set_initiator_name(self):
|
|
|
6903c7 |
manager = self.get_object('/Manager')
|
|
|
6903c7 |
|
|
|
6903c7 |
+ # make backup of INITIATOR_FILE and restore it at the end
|
|
|
6903c7 |
+ try:
|
|
|
6903c7 |
+ initiatorname_backup = self.read_file(INITIATOR_FILE)
|
|
|
6903c7 |
+ self.addCleanup(self.write_file, INITIATOR_FILE, initiatorname_backup)
|
|
|
6903c7 |
+ except FileNotFoundError as e:
|
|
|
6903c7 |
+ # no existing file, simply remove it once finished
|
|
|
6903c7 |
+ self.addCleanup(self.remove_file, INITIATOR_FILE, True)
|
|
|
6903c7 |
+
|
|
|
6903c7 |
manager.SetInitiatorName(self.initiator, self.no_options,
|
|
|
6903c7 |
dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator')
|
|
|
6903c7 |
|
|
|
6903c7 |
+ # running iscsid needs to be restarted to reflect the change
|
|
|
6903c7 |
+ self.run_command('systemctl try-reload-or-restart iscsid.service')
|
|
|
6903c7 |
+ # ignore the return code in case of non-systemd distros
|
|
|
6903c7 |
+
|
|
|
6903c7 |
init = manager.GetInitiatorName(self.no_options,
|
|
|
6903c7 |
dbus_interface=self.iface_prefix + '.Manager.ISCSI.Initiator')
|
|
|
6903c7 |
self.assertEqual(init, self.initiator)
|