diff --git a/tests/api2/test_iscsi_auth_network.py b/tests/api2/test_iscsi_auth_network.py index de6d2d1c83cad..79df689d0a207 100644 --- a/tests/api2/test_iscsi_auth_network.py +++ b/tests/api2/test_iscsi_auth_network.py @@ -49,7 +49,9 @@ def initiator(): try: yield initiator_config finally: - call('iscsi.initiator.delete', initiator_config['id']) + # Very likely that already cleaned up (by removing only target using it) + if call('iscsi.initiator.query', [['id', '=', initiator_config['id']]]): + call('iscsi.initiator.delete', initiator_config['id']) @contextlib.contextmanager