Vojtech Trefny 25ddfe
From 23b7573557e69d9b4dccdd6d52e82b82d8dba115 Mon Sep 17 00:00:00 2001
Vojtech Trefny 25ddfe
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 25ddfe
Date: Wed, 1 Dec 2021 16:28:15 +0100
Vojtech Trefny 25ddfe
Subject: [PATCH] iscsi: Replace all log_exception_info calls with log.info
Vojtech Trefny 25ddfe
Vojtech Trefny 25ddfe
We don't get any useful information from the exception, it's
Vojtech Trefny 25ddfe
always the same traceback from a failed DBus call and we only use
Vojtech Trefny 25ddfe
these when a called failed because firmware ISCSI is not supported.
Vojtech Trefny 25ddfe
The resulting log message also looks like a failure with the
Vojtech Trefny 25ddfe
traceback logged and not just as a debug information.
Vojtech Trefny 25ddfe
Vojtech Trefny 25ddfe
Resolves: rhbz#2028134
Vojtech Trefny 25ddfe
---
Vojtech Trefny 25ddfe
 blivet/iscsi.py | 9 ++++-----
Vojtech Trefny 25ddfe
 1 file changed, 4 insertions(+), 5 deletions(-)
Vojtech Trefny 25ddfe
Vojtech Trefny 25ddfe
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
Vojtech Trefny 25ddfe
index 5ee2082b..bc77ca62 100644
Vojtech Trefny 25ddfe
--- a/blivet/iscsi.py
Vojtech Trefny 25ddfe
+++ b/blivet/iscsi.py
Vojtech Trefny 25ddfe
@@ -22,7 +22,6 @@ from . import udev
Vojtech Trefny 25ddfe
 from . import util
Vojtech Trefny 25ddfe
 from .flags import flags
Vojtech Trefny 25ddfe
 from .i18n import _
Vojtech Trefny 25ddfe
-from .storage_log import log_exception_info
Vojtech Trefny 25ddfe
 from . import safe_dbus
Vojtech Trefny 25ddfe
 import os
Vojtech Trefny 25ddfe
 import re
Vojtech Trefny 25ddfe
@@ -277,8 +276,8 @@ class iSCSI(object):
Vojtech Trefny 25ddfe
                                           'org.freedesktop.DBus.ObjectManager',
Vojtech Trefny 25ddfe
                                           'GetManagedObjects',
Vojtech Trefny 25ddfe
                                           None)[0]
Vojtech Trefny 25ddfe
-        except safe_dbus.DBusCallError:
Vojtech Trefny 25ddfe
-            log_exception_info(log.info, "iscsi: Failed to get active sessions.")
Vojtech Trefny 25ddfe
+        except safe_dbus.DBusCallError as e:
Vojtech Trefny 25ddfe
+            log.info("iscsi: Failed to get active sessions: %s", str(e))
Vojtech Trefny 25ddfe
             return []
Vojtech Trefny 25ddfe
 
Vojtech Trefny 25ddfe
         sessions = (obj for obj in objects.keys() if re.match(r'.*/iscsi/session[0-9]+$', obj))
Vojtech Trefny 25ddfe
@@ -302,8 +301,8 @@ class iSCSI(object):
Vojtech Trefny 25ddfe
         args = GLib.Variant("(a{sv})", ([], ))
Vojtech Trefny 25ddfe
         try:
Vojtech Trefny 25ddfe
             found_nodes, _n_nodes = self._call_initiator_method("DiscoverFirmware", args)
Vojtech Trefny 25ddfe
-        except safe_dbus.DBusCallError:
Vojtech Trefny 25ddfe
-            log_exception_info(log.info, "iscsi: No IBFT info found.")
Vojtech Trefny 25ddfe
+        except safe_dbus.DBusCallError as e:
Vojtech Trefny 25ddfe
+            log.info("iscsi: No IBFT info found: %s", str(e))
Vojtech Trefny 25ddfe
             # an exception here means there is no ibft firmware, just return
Vojtech Trefny 25ddfe
             return
Vojtech Trefny 25ddfe
 
Vojtech Trefny 25ddfe
-- 
Vojtech Trefny 25ddfe
2.31.1
Vojtech Trefny 25ddfe