Python 3 deprecated the logger.warn method in favor of 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.

Closes-Bug: #1529913

Change-Id: I5d6d85b1ee4a63ebfb3348c093e37ab48b713e40
This commit is contained in:
LiuNanke 2015-12-29 11:53:12 +08:00
parent 4d7a594a1c
commit d49a78e9f8
5 changed files with 15 additions and 15 deletions

View File

@ -113,7 +113,7 @@ class ServersController(wsgi.Controller):
else:
if ext.obj.alias in whitelist:
if ext.obj.alias in blacklist:
LOG.warn(
LOG.warning(
_LW(
"Extension %s is both in whitelist and "
"blacklist, blacklisting takes precedence"

View File

@ -1290,7 +1290,7 @@ class ComputeManager(manager.Manager):
# NOTE(mriedem): If the _sync_power_states periodic task is
# disabled we should emit a warning in the logs.
if CONF.sync_power_state_interval < 0:
LOG.warn(_LW('Instance lifecycle events from the compute '
LOG.warning(_LW('Instance lifecycle events from the compute '
'driver have been disabled. Note that lifecycle '
'changes to an instance outside of the compute '
'service will not be synchronized '
@ -1747,7 +1747,7 @@ class ComputeManager(manager.Manager):
except exception.OverQuota:
msg = _LW('Failed to create block device for instance due to '
'being over volume resource quota')
LOG.warn(msg, instance=instance)
LOG.warning(msg, instance=instance)
raise exception.VolumeLimitExceeded()
except Exception:

View File

@ -54,7 +54,7 @@ def acquire_port(host):
ALLOCATED_PORTS.add((host, port))
return port
except exception.SocketPortInUseException as e:
LOG.warn(e.format_message())
LOG.warning(e.format_message())
raise exception.SocketPortRangeExhaustedException(host=host)

View File

@ -754,7 +754,7 @@ def floating_ip_get(context, id):
raise exception.FloatingIpNotFound(id=id)
except db_exc.DBError:
msg = _LW("Invalid floating IP ID %s in request") % id
LOG.warn(msg)
LOG.warning(msg)
raise exception.InvalidID(id=id)
return result
@ -1018,7 +1018,7 @@ def _floating_ip_get_by_address(context, address, session=None):
raise exception.FloatingIpNotFoundForAddress(address=address)
except db_exc.DBError:
msg = _("Invalid floating IP %s in request") % address
LOG.warn(msg)
LOG.warning(msg)
raise exception.InvalidIpAddressError(msg)
# If the floating IP has a project ID set, check to make sure
@ -1334,7 +1334,7 @@ def _fixed_ip_get_by_address(context, address, session=None,
raise exception.FixedIpNotFoundForAddress(address=address)
except db_exc.DBError:
msg = _("Invalid fixed IP Address %s in request") % address
LOG.warn(msg)
LOG.warning(msg)
raise exception.FixedIpInvalid(msg)
# NOTE(sirp): shouldn't we just use project_only here to restrict the
@ -1490,7 +1490,7 @@ def virtual_interface_get_by_address(context, address):
first()
except db_exc.DBError:
msg = _("Invalid virtual interface address %s in request") % address
LOG.warn(msg)
LOG.warning(msg)
raise exception.InvalidIpAddressError(msg)
return vif_ref
@ -1586,7 +1586,7 @@ def _validate_unique_server_name(context, session, name):
msg = _('Unknown osapi_compute_unique_server_name_scope value: %s'
' Flag must be empty, "global" or'
' "project"') % CONF.osapi_compute_unique_server_name_scope
LOG.warn(msg)
LOG.warning(msg)
return
if instance_with_same_name > 0:
@ -1775,7 +1775,7 @@ def instance_get(context, instance_id, columns_to_join=None):
# NOTE(sdague): catch all in case the db engine chokes on the
# id because it's too long of an int to store.
msg = _("Invalid instance id %s in request") % instance_id
LOG.warn(msg)
LOG.warning(msg)
raise exception.InvalidID(id=instance_id)
@ -5682,7 +5682,7 @@ def aggregate_metadata_add(context, aggregate_id, metadata, set_delete=False,
msg = _("Add metadata failed for aggregate %(id)s after "
"%(retries)s retries") % {"id": aggregate_id,
"retries": max_retries}
LOG.warn(msg)
LOG.warning(msg)
@require_aggregate_exists
@ -6074,7 +6074,7 @@ def _archive_deleted_rows_for_table(tablename, max_rows):
# A foreign key constraint keeps us from deleting some of
# these rows until we clean up a dependent table. Just
# skip this table for now; we'll come back to it later.
LOG.warn(_LW("IntegrityError detected when archiving table "
LOG.warning(_LW("IntegrityError detected when archiving table "
"%(tablename)s: %(error)s"),
{'tablename': tablename, 'error': six.text_type(ex)})
return rows_archived

View File

@ -606,12 +606,12 @@ class NetworkManager(manager.Manager):
for fixed_ip in fixed_ips:
vif = fixed_ip.virtual_interface
if not vif:
LOG.warn(_LW('No VirtualInterface for FixedIP: %s'),
LOG.warning(_LW('No VirtualInterface for FixedIP: %s'),
str(fixed_ip.address), instance_uuid=instance_uuid)
continue
if not fixed_ip.network:
LOG.warn(_LW('No Network for FixedIP: %s'),
LOG.warning(_LW('No Network for FixedIP: %s'),
str(fixed_ip.address), instance_uuid=instance_uuid)
continue
@ -1236,7 +1236,7 @@ class NetworkManager(manager.Manager):
oversize_msg = _LW(
'Subnet(s) too large, defaulting to /%s.'
' To override, specify network_size flag.') % subnet
LOG.warn(oversize_msg)
LOG.warning(oversize_msg)
kwargs["network_size"] = CONF.network_size
else:
kwargs["network_size"] = fixnet.size