From f775c81c89e5b665d55f2b4c8fabcadc61671745 Mon Sep 17 00:00:00 2001
From: zhongjun2 <jun.zhongjun2@gmail.com>
Date: Tue, 20 Dec 2016 08:56:11 +0800
Subject: [PATCH] Trivial fix LOG.exception issues

Remove redundant 'error' parameter in LOG.exception,
and replace some LOG.error with LOG.exception.

Change-Id: I46c14014c9dc38da9ea3b8ae98c9bd2aafe478d7
---
 manila/api/extensions.py                      |  4 +--
 manila/network/linux/ovs_lib.py               |  7 ++--
 manila/scheduler/scheduler_options.py         | 11 +++----
 .../drivers/container/container_helper.py     |  6 ++--
 .../dell_emc/plugins/unity/connection.py      | 32 +++++++++----------
 .../dell_emc/plugins/vnx/connection.py        |  4 +--
 .../drivers/dell_emc/plugins/vnx/connector.py |  8 ++---
 .../dell_emc/plugins/vnx/object_manager.py    | 11 +++----
 .../drivers/glusterfs/layout_directory.py     | 10 +++---
 manila/share/drivers/helpers.py               | 10 +++---
 manila/share/drivers/hpe/hpe_3par_mediator.py | 18 ++++-------
 .../netapp/dataontap/client/client_base.py    |  4 +--
 manila/share/drivers/zfsonlinux/utils.py      |  7 ++--
 manila/share/manager.py                       | 32 ++++++++-----------
 manila/share/share_types.py                   | 10 +++---
 .../glusterfs/test_layout_directory.py        |  4 +--
 .../dataontap/client/test_client_base.py      |  5 ++-
 manila/tests/share/test_manager.py            |  9 +++---
 18 files changed, 88 insertions(+), 104 deletions(-)

diff --git a/manila/api/extensions.py b/manila/api/extensions.py
index 2778387c47..6eabf090f2 100644
--- a/manila/api/extensions.py
+++ b/manila/api/extensions.py
@@ -181,8 +181,8 @@ class ExtensionManager(object):
             LOG.debug('Ext description: %s',
                       ' '.join(extension.__doc__.strip().split()))
             LOG.debug('Ext updated: %s', extension.updated)
-        except AttributeError as ex:
-            LOG.exception(_LE("Exception loading extension: %s"), ex)
+        except AttributeError:
+            LOG.exception(_LE("Exception loading extension."))
             return False
 
         return True
diff --git a/manila/network/linux/ovs_lib.py b/manila/network/linux/ovs_lib.py
index 58e304d6ac..6277e2f728 100644
--- a/manila/network/linux/ovs_lib.py
+++ b/manila/network/linux/ovs_lib.py
@@ -45,10 +45,9 @@ class OVSBridge(object):
         full_args = ["ovs-vsctl", "--timeout=2"] + args
         try:
             return utils.execute(*full_args, run_as_root=True)
-        except Exception as e:
-            LOG.error(_LE("Unable to execute %(cmd)s. Exception: "
-                          "%(exception)s"),
-                      {'cmd': full_args, 'exception': e})
+        except Exception:
+            LOG.exception(_LE("Unable to execute %(cmd)s."),
+                          {'cmd': full_args})
 
     def reset_bridge(self):
         self.run_vsctl(["--", "--if-exists", "del-br", self.br_name])
diff --git a/manila/scheduler/scheduler_options.py b/manila/scheduler/scheduler_options.py
index c39125e697..d11b9701f5 100644
--- a/manila/scheduler/scheduler_options.py
+++ b/manila/scheduler/scheduler_options.py
@@ -64,19 +64,18 @@ class SchedulerOptions(object):
         """Get the last modified datetime. Broken out for testing."""
         try:
             return os.path.getmtime(filename)
-        except os.error as e:
+        except os.error:
             LOG.exception(_LE("Could not stat scheduler options file "
-                              "%(filename)s: '%(e)s'"),
-                          {"filename": filename, "e": e})
+                              "%(filename)s."),
+                          {"filename": filename})
             raise
 
     def _load_file(self, handle):
         """Decode the JSON file. Broken out for testing."""
         try:
             return jsonutils.load(handle)
-        except ValueError as e:
-            LOG.exception(_LE("Could not decode scheduler options: "
-                              "'%(e)s'"), {"e": e})
+        except ValueError:
+            LOG.exception(_LE("Could not decode scheduler options."))
             return {}
 
     def _get_time_now(self):
diff --git a/manila/share/drivers/container/container_helper.py b/manila/share/drivers/container/container_helper.py
index f69f5be83f..5f3896b312 100644
--- a/manila/share/drivers/container/container_helper.py
+++ b/manila/share/drivers/container/container_helper.py
@@ -18,7 +18,7 @@ import uuid
 from oslo_log import log
 
 from manila import exception
-from manila.i18n import _, _LI
+from manila.i18n import _, _LE, _LI
 from manila.share import driver
 
 
@@ -93,8 +93,8 @@ class DockerExecHelper(driver.ExecuteMixin):
         LOG.debug("Executing command: %s.", " ".join(cmd))
         try:
             result = self._execute(*cmd, run_as_root=True)
-        except Exception as e:
-            LOG.exception(e)
+        except Exception:
+            LOG.exception(_LE("Executing command failed."))
             return None
         LOG.debug("Execution result: %s.", result)
         return result
diff --git a/manila/share/drivers/dell_emc/plugins/unity/connection.py b/manila/share/drivers/dell_emc/plugins/unity/connection.py
index 1dfabb806f..62d0866de6 100644
--- a/manila/share/drivers/dell_emc/plugins/unity/connection.py
+++ b/manila/share/drivers/dell_emc/plugins/unity/connection.py
@@ -114,10 +114,10 @@ class UnityStorageConnection(driver.StorageConnection):
         try:
             nas_server = self.client.get_nas_server(server_name)
         except storops_ex.UnityResourceNotFoundError:
-            message = (_LE("Failed to get NAS server %(server)s when "
-                           "creating the share %(share)s.") %
+            message = (_("Failed to get NAS server %(server)s when "
+                         "creating the share %(share)s.") %
                        {'server': server_name, 'share': share_name})
-            LOG.error(message)
+            LOG.exception(message)
             raise exception.EMCUnityError(err=message)
 
         locations = None
@@ -154,10 +154,10 @@ class UnityStorageConnection(driver.StorageConnection):
         try:
             nas_server = self.client.get_nas_server(server_name)
         except storops_ex.UnityResourceNotFoundError:
-            message = (_LE("Failed to get NAS server %(server)s when "
-                           "creating the share %(share)s.") %
+            message = (_("Failed to get NAS server %(server)s when "
+                         "creating the share %(share)s.") %
                        {'server': server_name, 'share': share_name})
-            LOG.error(message)
+            LOG.exception(message)
             raise exception.EMCUnityError(err=message)
 
         backend_snap = self.client.create_snap_of_snap(snapshot['id'],
@@ -324,7 +324,7 @@ class UnityStorageConnection(driver.StorageConnection):
                 stats_dict['pools'].append(pool_stat)
 
         if not stats_dict.get('pools'):
-            message = _LE("Failed to update storage pool.")
+            message = _("Failed to update storage pool.")
             LOG.error(message)
             raise exception.EMCUnityError(err=message)
 
@@ -355,9 +355,9 @@ class UnityStorageConnection(driver.StorageConnection):
 
             return {'share_server_name': server_name}
 
-        except Exception as ex:
+        except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_LE('Could not setup server. Reason: %s.'), ex)
+                LOG.exception(_LE('Could not setup server.'))
                 server_details = {'share_server_name': server_name}
                 self.teardown_server(
                     server_details, network_info['security_services'])
@@ -397,18 +397,18 @@ class UnityStorageConnection(driver.StorageConnection):
         try:
             self.nas_server_pool = self.client.get_pool(pool_name)
         except storops_ex.UnityResourceNotFoundError:
-            message = (_LE("The storage pools %s to store NAS server "
-                           "configuration do not exist.") % pool_name)
-            LOG.error(message)
+            message = (_("The storage pools %s to store NAS server "
+                         "configuration do not exist.") % pool_name)
+            LOG.exception(message)
             raise exception.BadConfigurationException(reason=message)
 
     def _config_sp(self, sp_name):
         self.storage_processor = self.client.get_storage_processor(
             sp_name.lower())
         if self.storage_processor is None:
-            message = (_LE("The storage processor %s does not exist or "
-                           "is unavailable. Please reconfigure it in "
-                           "manila.conf.") % sp_name)
+            message = (_("The storage processor %s does not exist or "
+                         "is unavailable. Please reconfigure it in "
+                         "manila.conf.") % sp_name)
             LOG.error(message)
             raise exception.BadConfigurationException(reason=message)
 
@@ -547,7 +547,7 @@ class UnityStorageConnection(driver.StorageConnection):
             'backend_details', {}).get('share_server_name')
 
         if server_name is None:
-            msg = (_LE("Name of the share server %s not found.")
+            msg = (_("Name of the share server %s not found.")
                    % share_server['id'])
             LOG.error(msg)
             raise exception.InvalidInput(reason=msg)
diff --git a/manila/share/drivers/dell_emc/plugins/vnx/connection.py b/manila/share/drivers/dell_emc/plugins/vnx/connection.py
index 8bbdd301ce..51746387d4 100644
--- a/manila/share/drivers/dell_emc/plugins/vnx/connection.py
+++ b/manila/share/drivers/dell_emc/plugins/vnx/connection.py
@@ -691,9 +691,9 @@ class VNXStorageConnection(driver.StorageConnection):
                 'nfs_if': nfs_interface['ip'],
             }
 
-        except Exception as ex:
+        except Exception:
             with excutils.save_and_reraise_exception():
-                LOG.error(_LE('Could not setup server. Reason: %s.'), ex)
+                LOG.exception(_LE('Could not setup server.'))
                 server_details = self._construct_backend_details(
                     vdm_name, allocated_interfaces)
                 self.teardown_server(
diff --git a/manila/share/drivers/dell_emc/plugins/vnx/connector.py b/manila/share/drivers/dell_emc/plugins/vnx/connector.py
index fd0b9a709f..ce6d3c8149 100644
--- a/manila/share/drivers/dell_emc/plugins/vnx/connector.py
+++ b/manila/share/drivers/dell_emc/plugins/vnx/connector.py
@@ -152,12 +152,10 @@ class SSHConnector(object):
                 self.log_request(command, out, err)
 
                 return out, err
-            except processutils.ProcessExecutionError as e:
+            except processutils.ProcessExecutionError:
                 with excutils.save_and_reraise_exception():
-                    msg = (_LE('Error running SSH command: %(cmd)s. '
-                               'Error: %(excmsg)s.'),
-                           {'cmd': command, 'excmsg': six.text_type(e)})
-                    LOG.error(msg)
+                    LOG.exception(_LE('Error running SSH command: %(cmd)s.'),
+                                  {'cmd': command})
 
     def log_request(self, cmd, out, err):
         if not self.debug:
diff --git a/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py b/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py
index 0e1855d00f..47cf3aa52f 100644
--- a/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py
+++ b/manila/share/drivers/dell_emc/plugins/vnx/object_manager.py
@@ -439,12 +439,11 @@ class FileSystem(StorageObject):
 
         try:
             self._execute_cmd(copy_ckpt_cmd, check_exit_code=True)
-        except processutils.ProcessExecutionError as e:
-            LOG.error(_LE("Failed to copy content from snapshot %(snap)s to "
-                          "file system %(filesystem)s. Reason: %(err)s."),
-                      {'snap': snap_name,
-                       'filesystem': name,
-                       'err': e})
+        except processutils.ProcessExecutionError:
+            LOG.exception(_LE("Failed to copy content from snapshot %(snap)s "
+                              "to file system %(filesystem)s."),
+                          {'snap': snap_name,
+                           'filesystem': name})
 
         # When an error happens during nas_copy, we need to continue
         # deleting the checkpoint of the target file system if it exists.
diff --git a/manila/share/drivers/glusterfs/layout_directory.py b/manila/share/drivers/glusterfs/layout_directory.py
index 5a1279c913..0bceb54a61 100644
--- a/manila/share/drivers/glusterfs/layout_directory.py
+++ b/manila/share/drivers/glusterfs/layout_directory.py
@@ -82,8 +82,8 @@ class GlusterfsDirectoryMappedLayout(layout.GlusterfsShareLayoutBase):
         except exception.GlusterfsException:
             if (self.gluster_manager.
                     get_vol_option('features.quota')) != 'on':
-                LOG.error(_LE("Error in tuning GlusterFS volume to enable "
-                              "creation of shares of specific size."))
+                LOG.exception(_LE("Error in tuning GlusterFS volume to enable "
+                                  "creation of shares of specific size."))
                 raise
 
         self._ensure_gluster_vol_mounted()
@@ -106,8 +106,8 @@ class GlusterfsDirectoryMappedLayout(layout.GlusterfsShareLayoutBase):
                                       self.gluster_manager.export, mount_path,
                                       ensure=True)
         except exception.GlusterfsException:
-            LOG.error(_LE('Could not mount the Gluster volume %s'),
-                      self.gluster_manager.volume)
+            LOG.exception(_LE('Could not mount the Gluster volume %s'),
+                          self.gluster_manager.volume)
             raise
 
     def _get_local_share_path(self, share):
@@ -182,7 +182,7 @@ class GlusterfsDirectoryMappedLayout(layout.GlusterfsShareLayoutBase):
         try:
             self.driver._execute(*cmd, run_as_root=True)
         except exception.ProcessExecutionError:
-            LOG.error(_LE('Unable to delete share %s'), share['name'])
+            LOG.exception(_LE('Unable to delete share %s'), share['name'])
             raise
 
     def ensure_share(self, context, share, share_server=None):
diff --git a/manila/share/drivers/helpers.py b/manila/share/drivers/helpers.py
index a134baf95f..e81a2e647a 100644
--- a/manila/share/drivers/helpers.py
+++ b/manila/share/drivers/helpers.py
@@ -378,10 +378,9 @@ class CIFSHelperIPAccess(NASHelperBase):
             # Share does not exist, create it
             try:
                 self._ssh_exec(server, create_cmd)
-            except Exception as child_e:
+            except Exception:
                 msg = _("Could not create CIFS export %s.") % share_name
-                LOG.exception(child_e)
-                LOG.error(msg)
+                LOG.exception(msg)
                 raise exception.ManilaException(reason=msg)
         else:
             # Share exists
@@ -390,10 +389,9 @@ class CIFSHelperIPAccess(NASHelperBase):
                     server, ['sudo', 'net', 'conf', 'delshare', share_name, ])
                 try:
                     self._ssh_exec(server, create_cmd)
-                except Exception as e:
+                except Exception:
                     msg = _("Could not create CIFS export %s.") % share_name
-                    LOG.exception(e)
-                    LOG.error(msg)
+                    LOG.exception(msg)
                     raise exception.ManilaException(reason=msg)
             else:
                 msg = _('Share section %s already defined.') % share_name
diff --git a/manila/share/drivers/hpe/hpe_3par_mediator.py b/manila/share/drivers/hpe/hpe_3par_mediator.py
index 4d19ce5ab7..237a611f5d 100644
--- a/manila/share/drivers/hpe/hpe_3par_mediator.py
+++ b/manila/share/drivers/hpe/hpe_3par_mediator.py
@@ -26,7 +26,7 @@ import six
 from manila.data import utils as data_utils
 from manila import exception
 from manila import utils
-from manila.i18n import _, _LI, _LW, _LE
+from manila.i18n import _, _LE, _LI, _LW
 
 hpe3parclient = importutils.try_import("hpe3parclient")
 if hpe3parclient:
@@ -1210,11 +1210,10 @@ class HPE3ParMediator(object):
         # Try to reclaim the space
         try:
             self._client.startfsnapclean(fpg, reclaimStrategy='maxspeed')
-        except Exception as e:
+        except Exception:
             # Remove already happened so only log this.
-            msg = (_('Unexpected exception calling startfsnapclean for FPG '
-                     '%(fpg)s: %(e)s') % {'fpg': fpg, 'e': six.text_type(e)})
-            LOG.exception(msg)
+            LOG.exception(_LE('Unexpected exception calling startfsnapclean '
+                              'for FPG %(fpg)s.'), {'fpg': fpg})
 
     @staticmethod
     def _validate_access_type(protocol, access_type):
@@ -1655,8 +1654,7 @@ class HPE3ParMediator(object):
         try:
             result = self._client.getfsip(vfs, fpg=fpg)
             LOG.debug("getfsip result: %s", result)
-        except Exception as e:
-            LOG.exception(e)
+        except Exception:
             msg = (_('Failed to get FSIPs for FPG/VFS %(fspool)s/%(vfs)s.') %
                    fsip)
             LOG.exception(msg)
@@ -1681,8 +1679,7 @@ class HPE3ParMediator(object):
                                              vlantag=vlantag_str)
             LOG.debug("createfsip result: %s", result)
 
-        except Exception as e:
-            LOG.exception(e)
+        except Exception:
             msg = (_('Failed to create FSIP for %s') % ip)
             LOG.exception(msg)
             raise exception.ShareBackendException(msg=msg)
@@ -1713,8 +1710,7 @@ class HPE3ParMediator(object):
             result = self._client.removefsip(vfs, ip, fpg=fpg)
             LOG.debug("removefsip result: %s", result)
 
-        except Exception as e:
-            LOG.exception(e)
+        except Exception:
             msg = (_('Failed to remove FSIP %s') % ip)
             LOG.exception(msg)
             raise exception.ShareBackendException(msg=msg)
diff --git a/manila/share/drivers/netapp/dataontap/client/client_base.py b/manila/share/drivers/netapp/dataontap/client/client_base.py
index f469cece01..77cab23d5b 100644
--- a/manila/share/drivers/netapp/dataontap/client/client_base.py
+++ b/manila/share/drivers/netapp/dataontap/client/client_base.py
@@ -87,9 +87,9 @@ class NetAppBaseClient(object):
     def get_licenses(self):
         try:
             result = self.send_request('license-v2-list-info')
-        except netapp_api.NaApiError as e:
+        except netapp_api.NaApiError:
             with excutils.save_and_reraise_exception():
-                LOG.error(_LE("Could not get licenses list. %s."), e)
+                LOG.exception(_LE("Could not get licenses list."))
 
         return sorted(
             [l.get_child_content('package').lower()
diff --git a/manila/share/drivers/zfsonlinux/utils.py b/manila/share/drivers/zfsonlinux/utils.py
index 5bfe83b8ba..acbab268cf 100644
--- a/manila/share/drivers/zfsonlinux/utils.py
+++ b/manila/share/drivers/zfsonlinux/utils.py
@@ -28,7 +28,7 @@ import six
 
 from manila.common import constants
 from manila import exception
-from manila.i18n import _, _LI, _LW
+from manila.i18n import _, _LE, _LI, _LW
 from manila.share import driver
 from manila.share.drivers.ganesha import utils as ganesha_utils
 from manila import utils
@@ -214,9 +214,8 @@ class NFSviaZFSHelper(ExecuteMixin, NASHelperBase):
                 msg=_("Utility 'exportfs' is not installed."))
         try:
             self.execute('sudo', 'exportfs')
-        except exception.ProcessExecutionError as e:
-            msg = _("Call of 'exportfs' utility returned error: %s")
-            LOG.exception(msg, e)
+        except exception.ProcessExecutionError:
+            LOG.exception(_LE("Call of 'exportfs' utility returned error."))
             raise
 
         # Init that class instance attribute on start of manila-share service
diff --git a/manila/share/manager.py b/manila/share/manager.py
index d6e09d68ea..3c3eeaa965 100644
--- a/manila/share/manager.py
+++ b/manila/share/manager.py
@@ -243,10 +243,10 @@ class ShareManager(manager.SchedulerDependentManager):
             # knowledge and update the DB.
             try:
                 pool = self.driver.get_pool(share_instance)
-            except Exception as err:
-                LOG.error(_LE("Failed to fetch pool name for share: "
-                              "%(share)s. Error: %(error)s."),
-                          {'share': share_instance['id'], 'error': err})
+            except Exception:
+                LOG.exception(_LE("Failed to fetch pool name for share: "
+                                  "%(share)s."),
+                              {'share': share_instance['id']})
                 return
 
             if pool:
@@ -269,13 +269,12 @@ class ShareManager(manager.SchedulerDependentManager):
         try:
             self.driver.do_setup(ctxt)
             self.driver.check_for_setup_error()
-        except Exception as e:
+        except Exception:
             LOG.exception(
                 _LE("Error encountered during initialization of driver "
-                    "'%(name)s' on '%(host)s' host. %(exc)s"), {
+                    "'%(name)s' on '%(host)s' host."), {
                         "name": self.driver.__class__.__name__,
                         "host": self.host,
-                        "exc": e,
                 }
             )
             self.driver.initialized = False
@@ -321,12 +320,10 @@ class ShareManager(manager.SchedulerDependentManager):
             try:
                 export_locations = self.driver.ensure_share(
                     ctxt, share_instance, share_server=share_server)
-            except Exception as e:
-                LOG.error(
-                    _LE("Caught exception trying ensure share '%(s_id)s'. "
-                        "Exception: \n%(e)s."),
-                    {'s_id': share_instance['id'], 'e': e},
-                )
+            except Exception:
+                LOG.exception(_LE("Caught exception trying ensure "
+                                  "share '%(s_id)s'."), {'s_id':
+                                                         share_instance['id']})
                 continue
 
             if export_locations:
@@ -339,12 +336,11 @@ class ShareManager(manager.SchedulerDependentManager):
                 try:
                     self.access_helper.update_access_rules(
                         ctxt, share_instance['id'], share_server=share_server)
-                except Exception as e:
-                    LOG.error(
+                except Exception:
+                    LOG.exception(
                         _LE("Unexpected error occurred while updating access "
-                            "rules for share instance %(s_id)s. "
-                            "Exception: \n%(e)s."),
-                        {'s_id': share_instance['id'], 'e': e},
+                            "rules for share instance %(s_id)s."),
+                        {'s_id': share_instance['id']},
                     )
 
         self.publish_service_capabilities(ctxt)
diff --git a/manila/share/share_types.py b/manila/share/share_types.py
index 0a2bd7e5fc..281348fd5e 100644
--- a/manila/share/share_types.py
+++ b/manila/share/share_types.py
@@ -54,8 +54,8 @@ def create(context, name, extra_specs=None, is_public=True, projects=None):
                                              extra_specs=extra_specs,
                                              is_public=is_public),
                                         projects=projects)
-    except db_exception.DBError as e:
-        LOG.exception(_LE('DB error: %s'), e)
+    except db_exception.DBError:
+        LOG.exception(_LE('DB error.'))
         raise exception.ShareTypeCreateFailed(name=name,
                                               extra_specs=extra_specs)
     return type_ref
@@ -87,11 +87,9 @@ def get_all_types(context, inactive=0, search_opts=None):
         try:
             required_extra_specs = get_valid_required_extra_specs(
                 type_args['extra_specs'])
-        except exception.InvalidExtraSpec as e:
+        except exception.InvalidExtraSpec:
             LOG.exception(_LE('Share type %(share_type)s has invalid required'
-                              ' extra specs: %(error)s'),
-                          {'share_type': type_name,
-                           'error': e})
+                              ' extra specs.'), {'share_type': type_name})
 
         type_args['required_extra_specs'] = required_extra_specs
 
diff --git a/manila/tests/share/drivers/glusterfs/test_layout_directory.py b/manila/tests/share/drivers/glusterfs/test_layout_directory.py
index 680d560767..1b555d4842 100644
--- a/manila/tests/share/drivers/glusterfs/test_layout_directory.py
+++ b/manila/tests/share/drivers/glusterfs/test_layout_directory.py
@@ -113,7 +113,7 @@ class GlusterfsDirectoryMappedLayoutTestCase(test.TestCase):
                  'gluster_call.side_effect': exception.GlusterfsException,
                  'get_vol_option.return_value': 'off'}
         fake_gluster_manager = mock.Mock(**attrs)
-        self.mock_object(layout_directory.LOG, 'error')
+        self.mock_object(layout_directory.LOG, 'exception')
         methods = ('_check_mount_glusterfs', '_ensure_gluster_vol_mounted')
         for method in methods:
             self.mock_object(self._layout, method)
@@ -133,7 +133,7 @@ class GlusterfsDirectoryMappedLayoutTestCase(test.TestCase):
             'volume', 'quota', 'testvol', 'enable')
         (self._layout.gluster_manager.get_vol_option.
          assert_called_once_with('features.quota'))
-        layout_directory.LOG.error.assert_called_once_with(mock.ANY)
+        layout_directory.LOG.exception.assert_called_once_with(mock.ANY)
         self._layout._check_mount_glusterfs.assert_called_once_with()
         self.assertFalse(self._layout._ensure_gluster_vol_mounted.called)
 
diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_base.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_base.py
index 04a89276ef..30940fa53c 100644
--- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_base.py
+++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_base.py
@@ -34,6 +34,9 @@ class NetAppBaseClientTestCase(test.TestCase):
         self.mock_object(client_base.LOG,
                          'error',
                          mock.Mock(side_effect=mock_logger.error))
+        self.mock_object(client_base.LOG,
+                         'exception',
+                         mock.Mock(side_effect=mock_logger.error))
 
         self.client = client_base.NetAppBaseClient(**fake.CONNECTION_INFO)
         self.client.connection = mock.MagicMock()
@@ -133,7 +136,7 @@ class NetAppBaseClientTestCase(test.TestCase):
                          mock.Mock(side_effect=netapp_api.NaApiError))
 
         self.assertRaises(netapp_api.NaApiError, self.client.get_licenses)
-        self.assertEqual(1, client_base.LOG.error.call_count)
+        self.assertEqual(1, client_base.LOG.exception.call_count)
 
     def test_send_ems_log_message(self):
 
diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py
index 39fe887cc1..9d542b4ef5 100644
--- a/manila/tests/share/test_manager.py
+++ b/manila/tests/share/test_manager.py
@@ -236,8 +236,7 @@ class ShareManagerTestCase(test.TestCase):
 
         manager.LOG.exception.assert_called_once_with(
             mock.ANY, {'name': self.share_manager.driver.__class__.__name__,
-                       'host': self.share_manager.host,
-                       'exc': mock.ANY})
+                       'host': self.share_manager.host})
         self.assertFalse(self.share_manager.driver.initialized)
 
     def _setup_init_mocks(self, setup_access_rules=True):
@@ -425,7 +424,7 @@ class ShareManagerTestCase(test.TestCase):
         self.mock_object(smanager, '_get_share_server',
                          mock.Mock(return_value=share_server))
         self.mock_object(smanager, 'publish_service_capabilities')
-        self.mock_object(manager.LOG, 'error')
+        self.mock_object(manager.LOG, 'exception')
         self.mock_object(manager.LOG, 'info')
         self.mock_object(smanager.db, 'share_access_get_all_for_share',
                          mock.Mock(return_value=rules))
@@ -472,7 +471,7 @@ class ShareManagerTestCase(test.TestCase):
             mock.call(utils.IsAMatcher(context.RequestContext),
                       instances[4]['id'], share_server=share_server),
         ])
-        manager.LOG.error.assert_has_calls([
+        manager.LOG.exception.assert_has_calls([
             mock.call(mock.ANY, mock.ANY),
         ])
 
@@ -2778,7 +2777,7 @@ class ShareManagerTestCase(test.TestCase):
             with mock.patch.object(manager, 'LOG') as mock_LOG:
                 self.share_manager._ensure_share_instance_has_pool(
                     context.get_admin_context(), fake_share)
-                self.assertEqual(1, mock_LOG.error.call_count)
+                self.assertEqual(1, mock_LOG.exception.call_count)
 
     def test__form_server_setup_info(self):
         def fake_network_allocations_get_for_share_server(*args, **kwargs):