From 44fc3021d41f19d8ad9b693f2faa56e5cab4159c Mon Sep 17 00:00:00 2001
From: huayue <huayuev5@gmail.com>
Date: Mon, 4 Jan 2016 09:57:39 +0800
Subject: [PATCH] Replace deprecated [logger/LOG].warn with warning

Python 3 deprecated the logger.warn method, see:
https://docs.python.org/3/library/logging.html#logging.warning, so we
prefer to use warning to avoid DeprecationWarning.

Change-Id: I6b09f67bb63fbdf31903ec175db012fc50e87f16
Closes-Bug: 1508442
---
 manila/api/auth.py                            | 13 +--
 manila/api/extensions.py                      | 28 +++---
 manila/api/middleware/sizelimit.py            | 10 +-
 manila/api/openstack/__init__.py              |  5 +-
 manila/api/openstack/urlmap.py                |  5 +-
 manila/api/sizelimit.py                       | 10 +-
 manila/api/v1/share_networks.py               | 13 +--
 manila/api/v2/quota_sets.py                   |  4 +-
 manila/context.py                             |  4 +-
 manila/network/linux/interface.py             |  4 +-
 manila/scheduler/host_manager.py              |  2 +-
 manila/service.py                             |  4 +-
 manila/share/api.py                           | 67 ++++++-------
 .../drivers/emc/plugins/isilon/isilon.py      |  4 +-
 .../drivers/emc/plugins/vnx/connection.py     |  6 +-
 .../drivers/emc/plugins/vnx/object_manager.py | 95 ++++++++++---------
 manila/share/drivers/glusterfs/common.py      |  2 +-
 .../share/drivers/glusterfs/layout_volume.py  | 10 +-
 manila/share/drivers/glusterfs_native.py      | 20 ++--
 .../share/drivers/windows/service_instance.py | 15 +--
 .../drivers/windows/windows_smb_driver.py     | 12 +--
 manila/tests/integrated/integrated_helpers.py |  2 +-
 manila/tests/network/linux/test_interface.py  |  2 +-
 manila/tests/scheduler/test_host_manager.py   |  8 +-
 .../share/drivers/glusterfs/test_common.py    |  6 +-
 .../drivers/glusterfs/test_layout_volume.py   |  2 +-
 manila/tests/test_context.py                  |  2 +-
 manila_tempest_tests/tests/api/base.py        |  4 +-
 28 files changed, 186 insertions(+), 173 deletions(-)

diff --git a/manila/api/auth.py b/manila/api/auth.py
index c0eba459bd..cdde03aadc 100644
--- a/manila/api/auth.py
+++ b/manila/api/auth.py
@@ -24,14 +24,15 @@ LOG = log.getLogger(__name__)
 
 class ManilaKeystoneContext(auth.ManilaKeystoneContext):
     def __init__(self, application):
-        LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. '
-                     'Please use '
-                     'manila.api.middleware.auth:ManilaKeystoneContext '
-                     'instead.'))
+        LOG.warning(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. '
+                        'Please use '
+                        'manila.api.middleware.auth:ManilaKeystoneContext '
+                        'instead.'))
         super(ManilaKeystoneContext, self).__init__(application)
 
 
 def pipeline_factory(loader, global_conf, **local_conf):
-    LOG.warn(_LW('manila.api.auth:pipeline_factory is deprecated. Please use '
-                 'manila.api.middleware.auth:pipeline_factory instead.'))
+    LOG.warning(_LW('manila.api.auth:pipeline_factory is deprecated. '
+                    'Please use manila.api.middleware.auth:pipeline_factory '
+                    'instead.'))
     auth.pipeline_factory(loader, global_conf, **local_conf)
diff --git a/manila/api/extensions.py b/manila/api/extensions.py
index 62f85a7657..f338a5361f 100644
--- a/manila/api/extensions.py
+++ b/manila/api/extensions.py
@@ -220,11 +220,11 @@ class ExtensionManager(object):
                             'standard_extensions')
         new_contrib_path = 'manila.api.contrib.standard_extensions'
         if old_contrib_path in extensions:
-            LOG.warn(_LW('osapi_share_extension is set to deprecated path: '
-                         '%s'),
-                     old_contrib_path)
-            LOG.warn(_LW('Please set your flag or manila.conf settings for '
-                         'osapi_share_extension to: %s'), new_contrib_path)
+            LOG.warning(_LW('osapi_share_extension is set to deprecated path: '
+                            '%s.'),
+                        old_contrib_path)
+            LOG.warning(_LW('Please set your flag or manila.conf settings for '
+                            'osapi_share_extension to: %s.'), new_contrib_path)
             extensions = [e.replace(old_contrib_path, new_contrib_path)
                           for e in extensions]
 
@@ -232,9 +232,9 @@ class ExtensionManager(object):
             try:
                 self.load_extension(ext_factory)
             except Exception as exc:
-                LOG.warn(_LW('Failed to load extension %(ext_factory)s: '
-                             '%(exc)s'),
-                         {"ext_factory": ext_factory, "exc": exc})
+                LOG.warning(_LW('Failed to load extension %(ext_factory)s: '
+                                '%(exc)s.'),
+                            {"ext_factory": ext_factory, "exc": exc})
 
 
 class ControllerExtension(object):
@@ -301,9 +301,9 @@ def load_standard_extensions(ext_mgr, logger, path, package, ext_list=None):
             try:
                 ext_mgr.load_extension(classpath)
             except Exception as exc:
-                logger.warn(_LW('Failed to load extension %(classpath)s: '
-                                '%(exc)s'),
-                            {"classpath": classpath, "exc": exc})
+                logger.warning(_LW('Failed to load extension %(classpath)s: '
+                                   '%(exc)s.'),
+                               {"classpath": classpath, "exc": exc})
 
         # Now, let's consider any subdirectories we may have...
         subdirs = []
@@ -326,9 +326,9 @@ def load_standard_extensions(ext_mgr, logger, path, package, ext_list=None):
                 try:
                     ext(ext_mgr)
                 except Exception as exc:
-                    logger.warn(_LW('Failed to load extension %(ext_name)s: '
-                                    '%(exc)s'),
-                                {"ext_name": ext_name, "exc": exc})
+                    logger.warning(_LW('Failed to load extension '
+                                       '%(ext_name)s: %(exc)s.'),
+                                   {"ext_name": ext_name, "exc": exc})
 
         # Update the list of directories we'll explore...
         dirnames[:] = subdirs
diff --git a/manila/api/middleware/sizelimit.py b/manila/api/middleware/sizelimit.py
index 8562427603..0a84ed9b72 100644
--- a/manila/api/middleware/sizelimit.py
+++ b/manila/api/middleware/sizelimit.py
@@ -26,8 +26,10 @@ LOG = log.getLogger(__name__)
 
 class RequestBodySizeLimiter(sizelimit.RequestBodySizeLimiter):
     def __init__(self, *args, **kwargs):
-        LOG.warn(_LW('manila.api.sizelimit:RequestBodySizeLimiter and '
-                     'manila.api.middleware.sizelimit:RequestBodySizeLimiter '
-                     'are deprecated. Please use oslo_middleware.sizelimit: '
-                     'RequestBodySizeLimiter instead.'))
+        LOG.warning(_LW('manila.api.sizelimit:RequestBodySizeLimiter and '
+                        'manila.api.middleware.sizelimit:'
+                        'RequestBodySizeLimiter '
+                        'are deprecated. Please use '
+                        'oslo_middleware.sizelimit: '
+                        'RequestBodySizeLimiter instead.'))
         super(RequestBodySizeLimiter, self).__init__(*args, **kwargs)
diff --git a/manila/api/openstack/__init__.py b/manila/api/openstack/__init__.py
index 79b55084f3..44606560a7 100644
--- a/manila/api/openstack/__init__.py
+++ b/manila/api/openstack/__init__.py
@@ -122,8 +122,9 @@ class APIRouter(base_wsgi.Router):
 
 class FaultWrapper(base_wsgi.Middleware):
     def __init__(self, application):
-        LOG.warn(_LW('manila.api.openstack:FaultWrapper is deprecated. Please '
-                     'use manila.api.middleware.fault:FaultWrapper instead.'))
+        LOG.warning(_LW('manila.api.openstack:FaultWrapper is deprecated. '
+                        'Please use '
+                        'manila.api.middleware.fault:FaultWrapper instead.'))
         # Avoid circular imports from here.
         from manila.api.middleware import fault
         super(FaultWrapper, self).__init__(fault.FaultWrapper(application))
diff --git a/manila/api/openstack/urlmap.py b/manila/api/openstack/urlmap.py
index 6482ac6285..426fc662ef 100644
--- a/manila/api/openstack/urlmap.py
+++ b/manila/api/openstack/urlmap.py
@@ -23,6 +23,7 @@ LOG = log.getLogger(__name__)
 
 
 def urlmap_factory(loader, global_conf, **local_conf):
-    LOG.warn(_LW('manila.api.openstack.urlmap:urlmap_factory is deprecated. '
-                 'Please use manila.api.urlmap:urlmap_factory instead.'))
+    LOG.warning(_LW('manila.api.openstack.urlmap:urlmap_factory '
+                    'is deprecated. '
+                    'Please use manila.api.urlmap:urlmap_factory instead.'))
     urlmap.urlmap_factory(loader, global_conf, **local_conf)
diff --git a/manila/api/sizelimit.py b/manila/api/sizelimit.py
index a54330a8ac..305d81d3c3 100644
--- a/manila/api/sizelimit.py
+++ b/manila/api/sizelimit.py
@@ -24,8 +24,10 @@ LOG = log.getLogger(__name__)
 
 class RequestBodySizeLimiter(sizelimit.RequestBodySizeLimiter):
     def __init__(self, *args, **kwargs):
-        LOG.warn(_LW('manila.api.sizelimit:RequestBodySizeLimiter and '
-                     'manila.api.middleware.sizelimit:RequestBodySizeLimiter '
-                     'are deprecated. Please use oslo_middleware.sizelimit: '
-                     'RequestBodySizeLimiter instead.'))
+        LOG.warning(_LW('manila.api.sizelimit:RequestBodySizeLimiter and '
+                        'manila.api.middleware.sizelimit:'
+                        'RequestBodySizeLimiter '
+                        'are deprecated. Please use '
+                        'oslo_middleware.sizelimit: '
+                        'RequestBodySizeLimiter instead.'))
         super(RequestBodySizeLimiter, self).__init__(*args, **kwargs)
diff --git a/manila/api/v1/share_networks.py b/manila/api/v1/share_networks.py
index eaaf5dadec..1968f9a51f 100644
--- a/manila/api/v1/share_networks.py
+++ b/manila/api/v1/share_networks.py
@@ -260,12 +260,13 @@ class ShareNetworkController(wsgi.Controller):
                 return (usages[name]['reserved'] + usages[name]['in_use'])
 
             if 'share_networks' in overs:
-                LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
-                             "share-network (%(d_consumed)d of %(d_quota)d "
-                             "already consumed)"), {
-                                 's_pid': context.project_id,
-                                 'd_consumed': _consumed('share_networks'),
-                                 'd_quota': quotas['share_networks']})
+                LOG.warning(_LW("Quota exceeded for %(s_pid)s, "
+                                "tried to create "
+                                "share-network (%(d_consumed)d of %(d_quota)d "
+                                "already consumed)."), {
+                                    's_pid': context.project_id,
+                                    'd_consumed': _consumed('share_networks'),
+                                    'd_quota': quotas['share_networks']})
                 raise exception.ShareNetworksLimitExceeded(
                     allowed=quotas['share_networks'])
         else:
diff --git a/manila/api/v2/quota_sets.py b/manila/api/v2/quota_sets.py
index cbe089d57d..ab1d65d24a 100644
--- a/manila/api/v2/quota_sets.py
+++ b/manila/api/v2/quota_sets.py
@@ -110,7 +110,7 @@ class QuotaSetsMixin(object):
                 except (ValueError, TypeError):
                     msg = _("Quota '%(value)s' for %(key)s should be "
                             "integer.") % {'value': value, 'key': key}
-                    LOG.warn(msg)
+                    LOG.warning(msg)
                     raise webob.exc.HTTPBadRequest(explanation=msg)
 
         LOG.debug("Force update quotas: %s.", force_update)
@@ -136,7 +136,7 @@ class QuotaSetsMixin(object):
             except (ValueError, TypeError):
                 msg = _("Quota '%(value)s' for %(key)s should be "
                         "integer.") % {'value': value, 'key': key}
-                LOG.warn(msg)
+                LOG.warning(msg)
                 raise webob.exc.HTTPBadRequest(explanation=msg)
 
             if force_update is False and value >= 0:
diff --git a/manila/context.py b/manila/context.py
index f6b5be8dcf..b75de1cad0 100644
--- a/manila/context.py
+++ b/manila/context.py
@@ -57,8 +57,8 @@ class RequestContext(object):
         user = kwargs.pop('user', None)
         tenant = kwargs.pop('tenant', None)
         if kwargs:
-            LOG.warn(_LW('Arguments dropped when creating context: %s'),
-                     str(kwargs))
+            LOG.warning(_LW('Arguments dropped when creating context: %s.'),
+                        str(kwargs))
 
         self.user_id = user_id or user
         self.project_id = project_id or tenant
diff --git a/manila/network/linux/interface.py b/manila/network/linux/interface.py
index f1ec2145d8..2d36cd0b8c 100644
--- a/manila/network/linux/interface.py
+++ b/manila/network/linux/interface.py
@@ -156,7 +156,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
                 namespace_obj.add_device_to_namespace(ns_dev)
 
         else:
-            LOG.warn(_LW("Device %s already exists"), device_name)
+            LOG.warning(_LW("Device %s already exists."), device_name)
         ns_dev.link.set_up()
 
     @device_name_synchronized
@@ -201,7 +201,7 @@ class BridgeInterfaceDriver(LinuxInterfaceDriver):
         else:
             ns_veth = ip.device(device_name)
             root_veth = ip.device(tap_name)
-            LOG.warn(_LW("Device %s already exists"), device_name)
+            LOG.warning(_LW("Device %s already exists."), device_name)
 
         root_veth.link.set_up()
         ns_veth.link.set_up()
diff --git a/manila/scheduler/host_manager.py b/manila/scheduler/host_manager.py
index 8d5b795543..ecb47730bd 100644
--- a/manila/scheduler/host_manager.py
+++ b/manila/scheduler/host_manager.py
@@ -492,7 +492,7 @@ class HostManager(object):
 
             # Warn about down services and remove them from host_state_map
             if not utils.service_is_up(service) or service['disabled']:
-                LOG.warn(_LW("Share service is down. (host: %s)") % host)
+                LOG.warning(_LW("Share service is down. (host: %s).") % host)
                 if self.host_state_map.pop(host, None):
                     LOG.info(_LI("Removing non-active host: %s from "
                                  "scheduler cache.") % host)
diff --git a/manila/service.py b/manila/service.py
index fcac4e61b1..ac1d57d0d8 100644
--- a/manila/service.py
+++ b/manila/service.py
@@ -194,7 +194,7 @@ class Service(service.Service):
         try:
             db.service_destroy(context.get_admin_context(), self.service_id)
         except exception.NotFound:
-            LOG.warn(_LW('Service killed that has no database entry'))
+            LOG.warning(_LW('Service killed that has no database entry.'))
 
     def stop(self):
         # Try to shut the connection down, but if we get any sort of
@@ -278,7 +278,7 @@ class WSGIService(service.ServiceBase):
         self.port = getattr(CONF, '%s_listen_port' % name, 0)
         self.workers = getattr(CONF, '%s_workers' % name, None)
         if self.workers is not None and self.workers < 1:
-            LOG.warn(
+            LOG.warning(
                 _LW("Value of config option %(name)s_workers must be integer "
                     "greater than 1.  Input value ignored.") % {'name': name})
             # Reset workers to default
diff --git a/manila/share/api.py b/manila/share/api.py
index b66d4df057..70f5cabd7e 100644
--- a/manila/share/api.py
+++ b/manila/share/api.py
@@ -146,20 +146,22 @@ class API(base.Base):
                 return (usages[name]['reserved'] + usages[name]['in_use'])
 
             if 'gigabytes' in overs:
-                LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
-                             "%(s_size)sG share (%(d_consumed)dG of "
-                             "%(d_quota)dG already consumed)"), {
-                                 's_pid': context.project_id,
-                                 's_size': size,
-                                 'd_consumed': _consumed('gigabytes'),
-                                 'd_quota': quotas['gigabytes']})
+                LOG.warning(_LW("Quota exceeded for %(s_pid)s, "
+                                "tried to create "
+                                "%(s_size)sG share (%(d_consumed)dG of "
+                                "%(d_quota)dG already consumed)."), {
+                                    's_pid': context.project_id,
+                                    's_size': size,
+                                    'd_consumed': _consumed('gigabytes'),
+                                    'd_quota': quotas['gigabytes']})
                 raise exception.ShareSizeExceedsAvailableQuota()
             elif 'shares' in overs:
-                LOG.warn(_LW("Quota exceeded for %(s_pid)s, tried to create "
-                             "share (%(d_consumed)d shares "
-                             "already consumed)"), {
-                                 's_pid': context.project_id,
-                                 'd_consumed': _consumed('shares')})
+                LOG.warning(_LW("Quota exceeded for %(s_pid)s, "
+                                "tried to create "
+                                "share (%(d_consumed)d shares "
+                                "already consumed)."), {
+                                    's_pid': context.project_id,
+                                    'd_consumed': _consumed('shares')})
                 raise exception.ShareLimitExceeded(allowed=quotas['shares'])
 
         try:
@@ -510,18 +512,18 @@ class API(base.Base):
             if 'snapshot_gigabytes' in overs:
                 msg = _LW("Quota exceeded for %(s_pid)s, tried to create "
                           "%(s_size)sG snapshot (%(d_consumed)dG of "
-                          "%(d_quota)dG already consumed)")
-                LOG.warn(msg, {'s_pid': context.project_id,
-                               's_size': size,
-                               'd_consumed': _consumed('gigabytes'),
-                               'd_quota': quotas['snapshot_gigabytes']})
+                          "%(d_quota)dG already consumed).")
+                LOG.warning(msg, {'s_pid': context.project_id,
+                                  's_size': size,
+                                  'd_consumed': _consumed('gigabytes'),
+                                  'd_quota': quotas['snapshot_gigabytes']})
                 raise exception.SnapshotSizeExceedsAvailableQuota()
             elif 'snapshots' in overs:
                 msg = _LW("Quota exceeded for %(s_pid)s, tried to create "
                           "snapshot (%(d_consumed)d snapshots "
-                          "already consumed)")
-                LOG.warn(msg, {'s_pid': context.project_id,
-                               'd_consumed': _consumed('snapshots')})
+                          "already consumed).")
+                LOG.warning(msg, {'s_pid': context.project_id,
+                                  'd_consumed': _consumed('snapshots')})
                 raise exception.SnapshotLimitExceeded(
                     allowed=quotas['snapshots'])
         options = {'share_id': share['id'],
@@ -824,10 +826,10 @@ class API(base.Base):
                 try:
                     self.deny_access_to_instance(ctx, share_instance, access)
                 except exception.NotFound:
-                    LOG.warn(_LW("Access rule %(access_id)s not found "
-                                 "for instance %(instance_id)s.") % {
-                        'access_id': access['id'],
-                        'instance_id': share_instance['id']})
+                    LOG.warning(_LW("Access rule %(access_id)s not found "
+                                    "for instance %(instance_id)s.") % {
+                                'access_id': access['id'],
+                                'instance_id': share_instance['id']})
         else:
             msg = _("Access policy should be %(active)s or in %(error)s "
                     "state") % {"active": constants.STATUS_ACTIVE,
@@ -893,21 +895,22 @@ class API(base.Base):
 
         for k, v in six.iteritems(metadata):
             if not k:
-                msg = _("Metadata property key is blank")
-                LOG.warn(msg)
+                msg = _("Metadata property key is blank.")
+                LOG.warning(msg)
                 raise exception.InvalidShareMetadata(message=msg)
             if len(k) > 255:
-                msg = _("Metadata property key is greater than 255 characters")
-                LOG.warn(msg)
+                msg = _("Metadata property key is "
+                        "greater than 255 characters.")
+                LOG.warning(msg)
                 raise exception.InvalidShareMetadataSize(message=msg)
             if not v:
-                msg = _("Metadata property value is blank")
-                LOG.warn(msg)
+                msg = _("Metadata property value is blank.")
+                LOG.warning(msg)
                 raise exception.InvalidShareMetadata(message=msg)
             if len(v) > 1023:
                 msg = _("Metadata property value is "
-                        "greater than 1023 characters")
-                LOG.warn(msg)
+                        "greater than 1023 characters.")
+                LOG.warning(msg)
                 raise exception.InvalidShareMetadataSize(message=msg)
 
     @policy.wrap_check_policy('share')
diff --git a/manila/share/drivers/emc/plugins/isilon/isilon.py b/manila/share/drivers/emc/plugins/isilon/isilon.py
index 51e2160e5c..6af05c60ec 100644
--- a/manila/share/drivers/emc/plugins/isilon/isilon.py
+++ b/manila/share/drivers/emc/plugins/isilon/isilon.py
@@ -141,7 +141,7 @@ class IsilonStorageConnection(base.StorageConnection):
         if share_id is None:
             lw = _LW('Attempted to delete NFS Share "%s", but the share does '
                      'not appear to exist.')
-            LOG.warn(lw, share['name'])
+            LOG.warning(lw, share['name'])
         else:
             # attempt to delete the share
             export_deleted = self._isilon_api.delete_nfs_share(share_id)
@@ -156,7 +156,7 @@ class IsilonStorageConnection(base.StorageConnection):
         if smb_share is None:
             lw = _LW('Attempted to delete CIFS Share "%s", but the share does '
                      'not appear to exist.')
-            LOG.warn(lw, share['name'])
+            LOG.warning(lw, share['name'])
         else:
             share_deleted = self._isilon_api.delete_smb_share(share['name'])
             if not share_deleted:
diff --git a/manila/share/drivers/emc/plugins/vnx/connection.py b/manila/share/drivers/emc/plugins/vnx/connection.py
index fdc0d7eb81..bcaf8c05b5 100644
--- a/manila/share/drivers/emc/plugins/vnx/connection.py
+++ b/manila/share/drivers/emc/plugins/vnx/connection.py
@@ -230,9 +230,9 @@ class VNXStorageConnection(driver.StorageConnection):
     def delete_share(self, context, share, share_server=None):
         """Delete a share."""
         if share_server is None:
-            LOG.warn(_LW("Driver does not support share deletion without "
-                         "share network specified. Return directly because "
-                         "there is nothing to clean."))
+            LOG.warning(_LW("Driver does not support share deletion without "
+                            "share network specified. Return directly because "
+                            "there is nothing to clean."))
             return
 
         share_proto = share['share_proto']
diff --git a/manila/share/drivers/emc/plugins/vnx/object_manager.py b/manila/share/drivers/emc/plugins/vnx/object_manager.py
index a55ec85cd4..15471b3141 100644
--- a/manila/share/drivers/emc/plugins/vnx/object_manager.py
+++ b/manila/share/drivers/emc/plugins/vnx/object_manager.py
@@ -91,11 +91,11 @@ class StorageObject(object):
                                        constants.STATUS_INFO):
             response['maxSeverity'] = constants.STATUS_OK
 
-            LOG.warn(_LW("Translated status from %(old)s to %(new)s. "
-                         "Message: %(info)s."),
-                     {'old': old_Severity,
-                      'new': response['maxSeverity'],
-                      'info': response})
+            LOG.warning(_LW("Translated status from %(old)s to %(new)s. "
+                            "Message: %(info)s."),
+                        {'old': old_Severity,
+                         'new': response['maxSeverity'],
+                         'info': response})
 
     def _response_validation(self, response, error_code):
         """Translate different status to ok/error status."""
@@ -248,8 +248,8 @@ class FileSystem(StorageObject):
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._response_validation(
                 response, constants.MSG_FILESYSTEM_EXIST):
-            LOG.warn(_LW("File system %s already exists. Skip the creation."),
-                     name)
+            LOG.warning(_LW("File system %s already exists. "
+                            "Skip the creation."), name)
             return
         elif constants.STATUS_OK != response['maxSeverity']:
             message = (_("Failed to create file system %(name)s. "
@@ -302,8 +302,8 @@ class FileSystem(StorageObject):
     def delete(self, name):
         status, out = self.get(name)
         if constants.STATUS_NOT_FOUND == status:
-            LOG.warn(_LW("File system %s not found. Skip the deletion."),
-                     name)
+            LOG.warning(_LW("File system %s not found. Skip the deletion."),
+                        name)
             return
         elif constants.STATUS_OK != status:
             message = (_("Failed to get file system by name %(name)s. "
@@ -573,8 +573,8 @@ class MountPoint(StorageObject):
             self.xml_retry = True
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._is_mount_point_already_existent(response):
-            LOG.warn(_LW("Mount Point %(mount)s already exists. "
-                         "Skip the creation."), {'mount': mount_path})
+            LOG.warning(_LW("Mount Point %(mount)s already exists. "
+                            "Skip the creation."), {'mount': mount_path})
             return
         elif constants.STATUS_OK != response['maxSeverity']:
             message = (_('Failed to create Mount Point %(mount)s for '
@@ -639,9 +639,9 @@ class MountPoint(StorageObject):
             self.xml_retry = True
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._is_mount_point_nonexistent(response):
-            LOG.warn(_LW('Mount point %(mount)s on mover %(mover_name)s '
-                         'not found.'),
-                     {'mount': mount_path, 'mover_name': mover_name})
+            LOG.warning(_LW('Mount point %(mount)s on mover %(mover_name)s '
+                            'not found.'),
+                        {'mount': mount_path, 'mover_name': mover_name})
 
             return
         elif constants.STATUS_OK != response['maxSeverity']:
@@ -871,8 +871,8 @@ class VDM(StorageObject):
             self.xml_retry = True
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._response_validation(response, constants.MSG_VDM_EXIST):
-            LOG.warn(_LW("VDM %(name)s already exists. Skip the creation."),
-                     {'name': name})
+            LOG.warning(_LW("VDM %(name)s already exists. Skip the creation."),
+                        {'name': name})
         elif constants.STATUS_OK != response['maxSeverity']:
             message = (_("Failed to create VDM %(name)s on mover "
                          "%(mover_name)s. Reason: %(err)s.") %
@@ -915,8 +915,8 @@ class VDM(StorageObject):
     def delete(self, name):
         status, out = self.get(name)
         if constants.STATUS_NOT_FOUND == status:
-            LOG.warn(_LW("VDM %s not found. Skip the deletion."),
-                     name)
+            LOG.warning(_LW("VDM %s not found. Skip the deletion."),
+                        name)
             return
         elif constants.STATUS_OK != status:
             message = (_("Failed to get VDM by name %(name)s. "
@@ -1050,9 +1050,9 @@ class Snapshot(StorageObject):
         response = self._send_request(request)
 
         if self._response_validation(response, constants.MSG_SNAP_EXIST):
-            LOG.warn(_LW("Snapshot %(name)s already exists. "
-                         "Skip the creation."),
-                     {'name': name})
+            LOG.warning(_LW("Snapshot %(name)s already exists. "
+                            "Skip the creation."),
+                        {'name': name})
         elif constants.STATUS_OK != response['maxSeverity']:
             message = (_("Failed to create snapshot %(name)s on "
                          "filesystem %(fs_name)s. Reason: %(err)s.") %
@@ -1095,8 +1095,8 @@ class Snapshot(StorageObject):
     def delete(self, name):
         status, out = self.get(name)
         if constants.STATUS_NOT_FOUND == status:
-            LOG.warn(_LW("Snapshot %s not found. Skip the deletion."),
-                     name)
+            LOG.warning(_LW("Snapshot %s not found. Skip the deletion."),
+                        name)
             return
         elif constants.STATUS_OK != status:
             message = (_("Failed to get snapshot by name %(name)s. "
@@ -1179,13 +1179,13 @@ class MoverInterface(StorageObject):
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._response_validation(
                 response, constants.MSG_INTERFACE_NAME_EXIST):
-            LOG.warn(_LW("Mover interface name %s already exists. "
-                         "Skip the creation."), name)
+            LOG.warning(_LW("Mover interface name %s already exists. "
+                            "Skip the creation."), name)
             return
         elif self._response_validation(
                 response, constants.MSG_INTERFACE_EXIST):
-            LOG.warn(_LW("Mover interface IP %s already exists. "
-                         "Skip the creation."), ip_addr)
+            LOG.warning(_LW("Mover interface IP %s already exists. "
+                            "Skip the creation."), ip_addr)
             return
         elif self._response_validation(
                 response, constants.MSG_INTERFACE_INVALID_VLAN_ID):
@@ -1245,8 +1245,8 @@ class MoverInterface(StorageObject):
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif self._response_validation(
                 response, constants.MSG_INTERFACE_NON_EXISTENT):
-            LOG.warn(_LW("Mover interface %s not found. Skip the deletion."),
-                     ip_addr)
+            LOG.warning(_LW("Mover interface %s not found. "
+                            "Skip the deletion."), ip_addr)
             return
         elif constants.STATUS_OK != response['maxSeverity']:
             message = (_("Failed to delete mover interface %(ip)s on mover "
@@ -1315,9 +1315,9 @@ class DNSDomain(StorageObject):
             self.xml_retry = True
             raise exception.EMCVnxInvalidMoverID(id=mover_id)
         elif constants.STATUS_OK != response['maxSeverity']:
-            LOG.warn(_LW("Failed to delete DNS domain %(name)s. "
-                         "Reason: %(err)s."),
-                     {'name': name, 'err': response['problems']})
+            LOG.warning(_LW("Failed to delete DNS domain %(name)s. "
+                            "Reason: %(err)s."),
+                        {'name': name, 'err': response['problems']})
 
 
 @vnx_utils.decorate_all_methods(vnx_utils.log_enter_exit,
@@ -1507,14 +1507,14 @@ class CIFSServer(StorageObject):
             status, out = self.get(
                 computer_name.lower(), mover_name, is_vdm, self.xml_retry)
             if constants.STATUS_NOT_FOUND == status:
-                LOG.warn(_LW("CIFS server %(name)s on mover %(mover_name)s "
-                             "not found. Skip the deletion."),
-                         {'name': computer_name, 'mover_name': mover_name})
+                LOG.warning(_LW("CIFS server %(name)s on mover %(mover_name)s "
+                                "not found. Skip the deletion."),
+                            {'name': computer_name, 'mover_name': mover_name})
                 return
         except exception.EMCVnxXMLAPIError:
-            LOG.warn(_LW("CIFS server %(name)s on mover %(mover_name)s "
-                         "not found. Skip the deletion."),
-                     {'name': computer_name, 'mover_name': mover_name})
+            LOG.warning(_LW("CIFS server %(name)s on mover %(mover_name)s "
+                            "not found. Skip the deletion."),
+                        {'name': computer_name, 'mover_name': mover_name})
             return
 
         server_name = out['name']
@@ -1605,8 +1605,8 @@ class CIFSShare(StorageObject):
     def delete(self, name, mover_name, is_vdm=True):
         status, out = self.get(name)
         if constants.STATUS_NOT_FOUND == status:
-            LOG.warn(_LW("CIFS share %s not found. Skip the deletion."),
-                     name)
+            LOG.warning(_LW("CIFS share %s not found. Skip the deletion."),
+                        name)
             return
         elif constants.STATUS_OK != status:
             message = (_("Failed to get CIFS share by name %(name)s. "
@@ -1683,8 +1683,8 @@ class CIFSShare(StorageObject):
             dup_msg = re.compile(r'ACE for %(domain)s\\%(user)s unchanged' %
                                  {'domain': domain, 'user': user_name}, re.I)
             if re.search(dup_msg, expt.stdout):
-                LOG.warn(_LW("Duplicate access control entry, "
-                             "skipping allow..."))
+                LOG.warning(_LW("Duplicate access control entry, "
+                                "skipping allow..."))
             else:
                 message = (_('Failed to allow the access %(access)s to '
                              'CIFS share %(name)s. Reason: %(err)s.') %
@@ -1715,10 +1715,10 @@ class CIFSShare(StorageObject):
                 % {'domain': domain, 'user': user_name}, re.I)
 
             if re.search(not_found_msg, expt.stdout):
-                LOG.warn(_LW("No access control entry found, "
-                             "skipping deny..."))
+                LOG.warning(_LW("No access control entry found, "
+                                "skipping deny..."))
             elif re.search(user_err_msg, expt.stdout):
-                LOG.warn(_LW("User not found on domain, skipping deny..."))
+                LOG.warning(_LW("User not found on domain, skipping deny..."))
             else:
                 message = (_('Failed to deny the access %(access)s to '
                              'CIFS share %(name)s. Reason: %(err)s.') %
@@ -1756,7 +1756,8 @@ class NFSShare(StorageObject):
 
         status, out = self.get(name, mover_name)
         if constants.STATUS_NOT_FOUND == status:
-            LOG.warn(_LW("NFS share %s not found. Skip the deletion."), path)
+            LOG.warning(_LW("NFS share %s not found. Skip the deletion."),
+                        path)
             return
 
         delete_nfs_share_cmd = [
@@ -1806,7 +1807,7 @@ class NFSShare(StorageObject):
             dup_msg = (r'%(mover_name)s : No such file or directory' %
                        {'mover_name': mover_name})
             if re.search(dup_msg, expt.stdout):
-                LOG.warn(_LW("NFS share %s not found."), name)
+                LOG.warning(_LW("NFS share %s not found."), name)
                 return constants.STATUS_NOT_FOUND, None
             else:
                 message = (_('Failed to list NFS share %(name)s on '
diff --git a/manila/share/drivers/glusterfs/common.py b/manila/share/drivers/glusterfs/common.py
index c93ac1f3b1..97310a89c2 100644
--- a/manila/share/drivers/glusterfs/common.py
+++ b/manila/share/drivers/glusterfs/common.py
@@ -232,7 +232,7 @@ def _mount_gluster_vol(execute, gluster_export, mount_path, ensure=False):
         execute(*command, run_as_root=True)
     except exception.ProcessExecutionError as exc:
         if ensure and 'already mounted' in exc.stderr:
-            LOG.warn(_LW("%s is already mounted"), gluster_export)
+            LOG.warning(_LW("%s is already mounted."), gluster_export)
         else:
             raise exception.GlusterfsException(
                 'Unable to mount Gluster volume'
diff --git a/manila/share/drivers/glusterfs/layout_volume.py b/manila/share/drivers/glusterfs/layout_volume.py
index c5b5d2974c..a13be80a99 100644
--- a/manila/share/drivers/glusterfs/layout_volume.py
+++ b/manila/share/drivers/glusterfs/layout_volume.py
@@ -256,11 +256,11 @@ class GlusterfsVolumeMappedLayout(layout.GlusterfsShareLayoutBase):
 
         if not unused_vols:
             # No volumes available for use as share. Warn user.
-            LOG.warn(_LW("No unused gluster volumes available for use as "
-                         "share! Create share won't be supported unless "
-                         "existing shares are deleted or some gluster "
-                         "volumes are created with names matching "
-                         "'glusterfs_volume_pattern'."))
+            LOG.warning(_LW("No unused gluster volumes available for use as "
+                            "share! Create share won't be supported unless "
+                            "existing shares are deleted or some gluster "
+                            "volumes are created with names matching "
+                            "'glusterfs_volume_pattern'."))
         else:
             LOG.info(_LI("Number of gluster volumes in use:  "
                          "%(inuse-numvols)s. Number of gluster volumes "
diff --git a/manila/share/drivers/glusterfs_native.py b/manila/share/drivers/glusterfs_native.py
index d523b656db..beaf9c945d 100644
--- a/manila/share/drivers/glusterfs_native.py
+++ b/manila/share/drivers/glusterfs_native.py
@@ -179,11 +179,11 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin,
         ssl_allow = re.split('[ ,]', ssl_allow_opt)
         access_to = access['access_to']
         if access_to in ssl_allow:
-            LOG.warn(_LW("Access to %(share)s at %(export)s is already "
-                         "granted for %(access_to)s. GlusterFS volume "
-                         "options might have been changed externally."),
-                     {'share': share['id'], 'export': gluster_mgr.qualified,
-                      'access_to': access_to})
+            LOG.warning(_LW("Access to %(share)s at %(export)s is already "
+                            "granted for %(access_to)s. GlusterFS volume "
+                            "options might have been changed externally."),
+                        {'share': share['id'], 'export': gluster_mgr.qualified,
+                         'access_to': access_to})
             return
 
         ssl_allow.append(access_to)
@@ -219,11 +219,11 @@ class GlusterfsNativeShareDriver(driver.ExecuteMixin,
         ssl_allow = re.split('[ ,]', ssl_allow_opt)
         access_to = access['access_to']
         if access_to not in ssl_allow:
-            LOG.warn(_LW("Access to %(share)s at %(export)s is already "
-                         "denied for %(access_to)s. GlusterFS volume "
-                         "options might have been changed externally."),
-                     {'share': share['id'], 'export': gluster_mgr.qualified,
-                      'access_to': access_to})
+            LOG.warning(_LW("Access to %(share)s at %(export)s is already "
+                            "denied for %(access_to)s. GlusterFS volume "
+                            "options might have been changed externally."),
+                        {'share': share['id'], 'export': gluster_mgr.qualified,
+                         'access_to': access_to})
             return
 
         ssl_allow.remove(access_to)
diff --git a/manila/share/drivers/windows/service_instance.py b/manila/share/drivers/windows/service_instance.py
index 445d787a5a..3ae2427763 100644
--- a/manila/share/drivers/windows/service_instance.py
+++ b/manila/share/drivers/windows/service_instance.py
@@ -234,19 +234,20 @@ class WindowsServiceInstanceManager(service_instance.ServiceInstanceManager):
         if not security_services:
             LOG.info(_LI("No security services provided."))
         elif len(security_services) > 1:
-            LOG.warn(_LW("Multiple security services provided. Only one "
-                         "security service of type 'active_directory' "
-                         "is supported."))
+            LOG.warning(_LW("Multiple security services provided. Only one "
+                            "security service of type 'active_directory' "
+                            "is supported."))
         else:
             security_service = security_services[0]
             security_service_type = security_service['type']
             if security_service_type == 'active_directory':
                 return security_service
             else:
-                LOG.warn(_LW("Only security services of type "
-                             "'active_directory' are supported. "
-                             "Retrieved security service type: %(sec_type)s"),
-                         {'sec_type': security_service_type})
+                LOG.warning(_LW("Only security services of type "
+                                "'active_directory' are supported. "
+                                "Retrieved security "
+                                "service type: %(sec_type)s."),
+                            {'sec_type': security_service_type})
         return None
 
     def _run_cloudbase_init_plugin_after_reboot(self, server, plugin_name):
diff --git a/manila/share/drivers/windows/windows_smb_driver.py b/manila/share/drivers/windows/windows_smb_driver.py
index a5fb48497a..c3b0840448 100644
--- a/manila/share/drivers/windows/windows_smb_driver.py
+++ b/manila/share/drivers/windows/windows_smb_driver.py
@@ -67,12 +67,12 @@ class WindowsSMBDriver(generic.GenericShareDriver):
                                                   security_service['user'],
                                                   security_service['password'])
             except Exception as exc:
-                LOG.warn(_LW("Failed to remove service instance "
-                             "%(instance_id)s from domain %(domain)s. "
-                             "Exception: %(exc)s"),
-                         dict(instance_id=server_details['instance_id'],
-                              domain=security_service['domain'],
-                              exc=exc))
+                LOG.warning(_LW("Failed to remove service instance "
+                                "%(instance_id)s from domain %(domain)s. "
+                                "Exception: %(exc)s."),
+                            dict(instance_id=server_details['instance_id'],
+                                 domain=security_service['domain'],
+                                 exc=exc))
         super(WindowsSMBDriver, self)._teardown_server(server_details,
                                                        security_services)
 
diff --git a/manila/tests/integrated/integrated_helpers.py b/manila/tests/integrated/integrated_helpers.py
index 0f9e6d9d27..ca4d62bb5a 100644
--- a/manila/tests/integrated/integrated_helpers.py
+++ b/manila/tests/integrated/integrated_helpers.py
@@ -83,7 +83,7 @@ class _IntegratedTestBase(test.TestCase):
         # FIXME(ja): this is not the auth url - this is the service url
         # FIXME(ja): this needs fixed in nova as well
         self.auth_url = 'http://%s:%s/v1' % (self.osapi.host, self.osapi.port)
-        LOG.warn(self.auth_url)
+        LOG.warning(self.auth_url)
 
     def _get_flags(self):
         """An opportunity to setup flags, before the services are started."""
diff --git a/manila/tests/network/linux/test_interface.py b/manila/tests/network/linux/test_interface.py
index deca09eb53..2d8c044042 100644
--- a/manila/tests/network/linux/test_interface.py
+++ b/manila/tests/network/linux/test_interface.py
@@ -209,7 +209,7 @@ class TestBridgeInterfaceDriver(TestBase):
 
     def test_plug_dev_exists(self):
         self.device_exists.return_value = True
-        with mock.patch('manila.network.linux.interface.LOG.warn') as log:
+        with mock.patch('manila.network.linux.interface.LOG.warning') as log:
             br = interface.BridgeInterfaceDriver()
             br.plug('port-1234',
                     'tap0',
diff --git a/manila/tests/scheduler/test_host_manager.py b/manila/tests/scheduler/test_host_manager.py
index fcb1ada6f5..9bb6ff6810 100644
--- a/manila/tests/scheduler/test_host_manager.py
+++ b/manila/tests/scheduler/test_host_manager.py
@@ -169,7 +169,7 @@ class HostManagerTestCase(test.TestCase):
         self.mock_object(
             db, 'service_get_all_by_topic',
             mock.Mock(return_value=fakes.SHARE_SERVICES_NO_POOLS))
-        host_manager.LOG.warn = mock.Mock()
+        host_manager.LOG.warning = mock.Mock()
 
         with mock.patch.dict(self.host_manager.service_states,
                              fakes.SERVICE_STATES_NO_POOLS):
@@ -259,7 +259,7 @@ class HostManagerTestCase(test.TestCase):
         self.mock_object(
             db, 'service_get_all_by_topic',
             mock.Mock(return_value=fakes.SHARE_SERVICES_WITH_POOLS))
-        host_manager.LOG.warn = mock.Mock()
+        host_manager.LOG.warning = mock.Mock()
 
         with mock.patch.dict(self.host_manager.service_states,
                              fakes.SHARE_SERVICE_STATES_WITH_POOLS):
@@ -401,7 +401,7 @@ class HostManagerTestCase(test.TestCase):
         self.mock_object(
             db, 'service_get_all_by_topic',
             mock.Mock(return_value=fakes.SHARE_SERVICES_NO_POOLS))
-        host_manager.LOG.warn = mock.Mock()
+        host_manager.LOG.warning = mock.Mock()
 
         with mock.patch.dict(self.host_manager.service_states,
                              fakes.SERVICE_STATES_NO_POOLS):
@@ -483,7 +483,7 @@ class HostManagerTestCase(test.TestCase):
         self.mock_object(
             db, 'service_get_all_by_topic',
             mock.Mock(return_value=fakes.SHARE_SERVICES_WITH_POOLS))
-        host_manager.LOG.warn = mock.Mock()
+        host_manager.LOG.warning = mock.Mock()
 
         with mock.patch.dict(self.host_manager.service_states,
                              fakes.SHARE_SERVICE_STATES_WITH_POOLS):
diff --git a/manila/tests/share/drivers/glusterfs/test_common.py b/manila/tests/share/drivers/glusterfs/test_common.py
index 52760879ac..b61453be69 100644
--- a/manila/tests/share/drivers/glusterfs/test_common.py
+++ b/manila/tests/share/drivers/glusterfs/test_common.py
@@ -347,14 +347,14 @@ class GlusterFSCommonTestCase(test.TestCase):
         def exec_runner(*ignore_args, **ignore_kwargs):
             raise exception.ProcessExecutionError(stderr='already mounted')
         expected_exec = self._mount_exec(fakeexport, fakemnt)
-        common.LOG.warn = mock.Mock()
+        common.LOG.warning = mock.Mock()
         fake_utils.fake_execute_set_repliers([('mount', exec_runner)])
         ret = common._mount_gluster_vol(self._execute, fakeexport, fakemnt,
                                         True)
         self.assertEqual(fake_utils.fake_execute_get_log(), expected_exec)
         self.assertIsNone(ret)
-        common.LOG.warn.assert_called_with(
-            "%s is already mounted", fakeexport)
+        common.LOG.warning.assert_called_with(
+            "%s is already mounted.", fakeexport)
 
     @ddt.data(True, False)
     def test_mount_gluster_vol_fail(self, ensure):
diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py
index 78ea2c7c91..0e07c1285f 100644
--- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py
+++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py
@@ -278,7 +278,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase):
                          mock.Mock(return_value=self.glusterfs_volumes_dict))
         self.mock_object(self._layout, '_check_mount_glusterfs')
         self._layout.gluster_used_vols = self.glusterfs_used_vols
-        self.mock_object(layout_volume.LOG, 'warn')
+        self.mock_object(layout_volume.LOG, 'warning')
 
         self._layout.do_setup(self._context)
 
diff --git a/manila/tests/test_context.py b/manila/tests/test_context.py
index 843fcfdf80..1cde1659d9 100644
--- a/manila/tests/test_context.py
+++ b/manila/tests/test_context.py
@@ -69,7 +69,7 @@ class ContextTestCase(test.TestCase):
         def fake_warn(log_msg, other_args):
             info['log_msg'] = log_msg % other_args
 
-        self.mock_object(context.LOG, 'warn', fake_warn)
+        self.mock_object(context.LOG, 'warning', fake_warn)
 
         c = context.RequestContext('user',
                                    'project',
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index d57b49384e..b9763fb980 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -613,8 +613,8 @@ class BaseSharesTest(test.BaseTestCase):
                         client.delete_cgsnapshot(res_id)
                         client.wait_for_resource_deletion(cgsnapshot_id=res_id)
                     else:
-                        LOG.warn("Provided unsupported resource type for "
-                                 "cleanup '%s'. Skipping." % res["type"])
+                        LOG.warning("Provided unsupported resource type for "
+                                    "cleanup '%s'. Skipping." % res["type"])
                 res["deleted"] = True
 
     @classmethod