description = backup.get('description', None)
LOG.audit(_("Creating backup of volume %(volume_id)s in container"
- " %(container)s"), locals(), context=context)
+ " %(container)s"),
+ {'volume_id': volume_id, 'container': container},
+ context=context)
try:
new_backup = self.backup_api.create(context, name, description,
@wsgi.deserializers(xml=RestoreDeserializer)
def restore(self, req, id, body):
"""Restore an existing backup to a volume."""
- backup_id = id
- LOG.debug(_('Restoring backup %(backup_id)s (%(body)s)') % locals())
+ LOG.debug(_('Restoring backup %(backup_id)s (%(body)s)'),
+ {'backup_id': id, 'body': body})
if not self.is_valid_body(body, 'restore'):
raise exc.HTTPBadRequest()
volume_id = restore.get('volume_id', None)
LOG.audit(_("Restoring backup %(backup_id)s to volume %(volume_id)s"),
- locals(), context=context)
+ {'backup_id': id, 'volume_id': volume_id},
+ context=context)
try:
new_restore = self.backup_api.restore(context,
- backup_id=backup_id,
+ backup_id=id,
volume_id=volume_id)
except exception.InvalidInput as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
"""Sets the specified host's ability to accept new volumes."""
context = req.environ['cinder.context']
state = "enabled" if enabled else "disabled"
- LOG.audit(_("Setting host %(host)s to %(state)s.") % locals())
+ LOG.audit(_("Setting host %(host)s to %(state)s."),
+ {'host': host, 'state': state})
result = self.api.set_host_enabled(context,
host=host,
enabled=enabled)
self.load_extension(ext_factory)
except Exception as exc:
LOG.warn(_('Failed to load extension %(ext_factory)s: '
- '%(exc)s') % locals())
+ '%(exc)s'),
+ {'ext_factory': ext_factory, 'exc': exc})
class ControllerExtension(object):
ext_mgr.load_extension(classpath)
except Exception as exc:
logger.warn(_('Failed to load extension %(classpath)s: '
- '%(exc)s') % locals())
+ '%(exc)s'),
+ {'classpath': classpath, 'exc': exc})
# Now, let's consider any subdirectories we may have...
subdirs = []
ext(ext_mgr)
except Exception as exc:
logger.warn(_('Failed to load extension %(ext_name)s: '
- '%(exc)s') % locals())
+ '%(exc)s'),
+ {'ext_name': ext_name, 'exc': exc})
# Update the list of directories we'll explore...
dirnames[:] = subdirs
def _setup_extensions(self, ext_mgr):
for extension in ext_mgr.get_controller_extensions():
- ext_name = extension.extension.name
collection = extension.collection
controller = extension.controller
if collection not in self.resources:
LOG.warning(_('Extension %(ext_name)s: Cannot extend '
- 'resource %(collection)s: No such resource') %
- locals())
+ 'resource %(collection)s: No such resource'),
+ {'ext_name': extension.extension.name,
+ 'collection': collection})
continue
LOG.debug(_('Extension %(ext_name)s extending resource: '
- '%(collection)s') % locals())
+ '%(collection)s'),
+ {'ext_name': extension.extension.name,
+ 'collection': collection})
resource = self.resources[collection]
resource.register_actions(controller)
unknown_options = [opt for opt in search_options
if opt not in allowed_search_options]
bad_options = ", ".join(unknown_options)
- log_msg = _("Removing options '%(bad_options)s' from query") % locals()
+ log_msg = _("Removing options '%(bad_options)s'"
+ " from query") % {'bad_options': bad_options}
LOG.debug(log_msg)
for opt in unknown_options:
del search_options[opt]
# Make sure we have a tree match
if slave.root.tag != self.root.tag:
- slavetag = slave.root.tag
- mastertag = self.root.tag
- msg = _("Template tree mismatch; adding slave %(slavetag)s "
- "to master %(mastertag)s") % locals()
+ msg = (_("Template tree mismatch; adding slave %(slavetag)s "
+ "to master %(mastertag)s") %
+ {'slavetag': slave.root.tag,
+ 'mastertag': self.root.tag})
raise ValueError(msg)
# Make sure slave applies to this template