replace string format arguments with function parameters

There are files containing string format arguments inside
logging messages. Using logging function parameters
should be preferred.

Change-Id: Ic053903056ba3479a787aad6e9a359ba1efc35f8
Closes-Bug: #1321274
This commit is contained in:
ting.wang 2016-02-10 22:53:50 +08:00
parent e5f4e981f5
commit 09dfc861c8
8 changed files with 16 additions and 16 deletions

View File

@ -364,7 +364,7 @@ class API(base.Base):
'scheduled_at': timeutils.utcnow(),
})
LOG.debug("Manage: Found shares %s" % len(shares))
LOG.debug("Manage: Found shares %s.", len(shares))
retry_states = (constants.STATUS_MANAGE_ERROR,)

View File

@ -543,7 +543,7 @@ class ShareDriver(object):
'new_instance_id': new_share_instance['id']})
raise exception.ShareMigrationFailed(reason=msg)
LOG.debug("Copying completed in migration for share %s." % share['id'])
LOG.debug("Copying completed in migration for share %s.", share['id'])
def create_share(self, context, share, share_server=None):
"""Is called to create share."""

View File

@ -542,7 +542,7 @@ class ShareManager(manager.SchedulerDependentManager):
@utils.require_driver_initialized
def migrate_share(self, ctxt, share_id, host, force_host_copy=False):
"""Migrates a share from current host to another host."""
LOG.debug("Entered migrate_share method for share %s." % share_id)
LOG.debug("Entered migrate_share method for share %s.", share_id)
# NOTE(ganso): Cinder checks if driver is initialized before doing
# anything. This might not be needed, as this code may not be reached
@ -577,7 +577,7 @@ class ShareManager(manager.SchedulerDependentManager):
dest_driver_migration_info = rpcapi.get_driver_migration_info(
ctxt, share_instance, share_server)
LOG.debug("Calling driver migration for share %s." % share_id)
LOG.debug("Calling driver migration for share %s.", share_id)
moved, model_update = self.driver.migrate_share(
ctxt, share_instance, host, dest_driver_migration_info)
@ -598,7 +598,7 @@ class ShareManager(manager.SchedulerDependentManager):
if not moved:
try:
LOG.debug("Starting generic migration "
"for share %s." % share_id)
"for share %s.", share_id)
moved = self._migrate_share_generic(ctxt, share_ref, host)
except Exception as e:
@ -657,7 +657,7 @@ class ShareManager(manager.SchedulerDependentManager):
)
LOG.debug("Time to start copying in migration"
" for share %s." % share['id'])
" for share %s.", share['id'])
share_server = self._get_share_server(context.elevated(),
share_instance)

View File

@ -263,7 +263,7 @@ class ShareMigrationHelper(object):
if readonly_support:
LOG.debug("Changing all of share %s access rules "
"to read-only." % self.share['id'])
"to read-only.", self.share['id'])
self.add_rules_and_wait(self.context, self.share,
saved_rules, 'ro')
@ -278,7 +278,7 @@ class ShareMigrationHelper(object):
self.context, self.share['id'])
LOG.debug("Removing all of share %s read-only "
"access rules." % self.share['id'])
"access rules.", self.share['id'])
self.deny_rules_and_wait(self.context, self.share, readonly_rules)

View File

@ -98,7 +98,7 @@ def fake_execute(*cmd_parts, **kwargs):
stdout = reply[0]
stderr = reply[1]
LOG.debug("Reply to faked command is stdout='%(stdout)s' "
"stderr='%(stderr)s'" % {"stdout": stdout, "stderr": stderr})
"stderr='%(stderr)s'.", {"stdout": stdout, "stderr": stderr})
# Replicate the sleep call in the real function
greenthread.sleep(0)

View File

@ -122,7 +122,7 @@ class TestOpenStackClient(object):
headers=headers)
http_status = response.status
LOG.debug("%(auth_uri)s => code %(http_status)s" %
LOG.debug("%(auth_uri)s => code %(http_status)s.",
{"auth_uri": auth_uri, "http_status": http_status})
if http_status == 401:
@ -148,7 +148,7 @@ class TestOpenStackClient(object):
response = self.request(full_uri, **kwargs)
http_status = response.status
LOG.debug("%(relative_uri)s => code %(http_status)s" %
LOG.debug("%(relative_uri)s => code %(http_status)s.",
{"relative_uri": relative_uri, "http_status": http_status})
if check_response_status:
@ -166,7 +166,7 @@ class TestOpenStackClient(object):
def _decode_json(self, response):
body = response.read()
LOG.debug("Decoding JSON: %s" % (body))
LOG.debug("Decoding JSON: %s.", (body))
if body:
return jsonutils.loads(body)
else:

View File

@ -54,7 +54,7 @@ def generate_new_element(items, prefix, numeric=False):
candidate = prefix + generate_random_alphanumeric(8)
if candidate not in items:
return candidate
LOG.debug("Random collision on %s" % candidate)
LOG.debug("Random collision on %s.", candidate)
class _IntegratedTestBase(test.TestCase):
@ -109,7 +109,7 @@ class _IntegratedTestBase(test.TestCase):
server = {}
image = self.api.get_images()[0]
LOG.debug("Image: %s" % image)
LOG.debug("Image: %s.", image)
if 'imageRef' in image:
image_href = image['imageRef']
@ -122,7 +122,7 @@ class _IntegratedTestBase(test.TestCase):
# Set a valid flavorId
flavor = self.api.get_flavors()[0]
LOG.debug("Using flavor: %s" % flavor)
LOG.debug("Using flavor: %s.", flavor)
server['flavorRef'] = 'http://fake.server/%s' % flavor['id']
# Set a valid server name

View File

@ -35,5 +35,5 @@ class ExtensionsTest(integrated_helpers._IntegratedTestBase):
"""Simple check that fox-n-socks works."""
response = self.api.api_request('/foxnsocks')
foxnsocks = response.read()
LOG.debug("foxnsocks: %s" % foxnsocks)
LOG.debug("foxnsocks: %s.", foxnsocks)
self.assertEqual(six.b('Try to say this Mr. Knox, sir...'), foxnsocks)