Merge "Standardize logging for v2 api extensions"
This commit is contained in:
commit
6b844e3f45
@ -25,6 +25,7 @@ from nova import compute
|
||||
from nova.compute import vm_states
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LE
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.openstack.common import strutils
|
||||
|
||||
@ -64,7 +65,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::pause %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::pause %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -86,7 +87,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::unpause %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::unpause %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -108,7 +109,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("compute.api::suspend %s"), readable)
|
||||
LOG.exception(_LE("compute.api::suspend %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -130,7 +131,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("compute.api::resume %s"), readable)
|
||||
LOG.exception(_LE("compute.api::resume %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -156,7 +157,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
except exception.NoValidHost as e:
|
||||
raise exc.HTTPBadRequest(explanation=e.format_message())
|
||||
except Exception as e:
|
||||
LOG.exception(_("Error in migrate %s"), e)
|
||||
LOG.exception(_LE("Error in migrate %s"), e)
|
||||
raise exc.HTTPBadRequest()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -175,7 +176,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPConflict(explanation=e.format_message())
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::reset_network %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::reset_network %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -194,7 +195,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPConflict(explanation=e.format_message())
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::inject_network_info %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::inject_network_info %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -211,7 +212,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::lock %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::lock %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -230,7 +231,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::unlock %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::unlock %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@ -388,7 +389,7 @@ class AdminActionsController(wsgi.Controller):
|
||||
raise exc.HTTPNotFound(explanation=msg)
|
||||
except Exception:
|
||||
readable = traceback.format_exc()
|
||||
LOG.exception(_("Compute.api::resetState %s"), readable)
|
||||
LOG.exception(_LE("Compute.api::resetState %s"), readable)
|
||||
raise exc.HTTPUnprocessableEntity()
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
|
@ -23,10 +23,8 @@ from nova.api.openstack import extensions
|
||||
from nova.compute import api as compute_api
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.openstack.common import log as logging
|
||||
from nova import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
authorize = extensions.extension_authorizer('compute', 'aggregates')
|
||||
|
||||
|
||||
|
@ -85,8 +85,6 @@ class FloatingIPBulkController(object):
|
||||
raise webob.exc.HTTPUnprocessableEntity()
|
||||
params = body['floating_ips_bulk_create']
|
||||
|
||||
LOG.debug(params)
|
||||
|
||||
if 'ip_range' not in params:
|
||||
raise webob.exc.HTTPUnprocessableEntity()
|
||||
ip_range = params['ip_range']
|
||||
|
@ -23,6 +23,7 @@ from nova.api.openstack import wsgi
|
||||
from nova import compute
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LE
|
||||
from nova.openstack.common import log as logging
|
||||
|
||||
|
||||
@ -81,7 +82,7 @@ class MultinicController(wsgi.Controller):
|
||||
try:
|
||||
self.compute_api.remove_fixed_ip(context, instance, address)
|
||||
except exception.FixedIpNotFoundForSpecificInstance:
|
||||
LOG.exception(_("Unable to find address %r") % address,
|
||||
LOG.exception(_LE("Unable to find address %r"), address,
|
||||
instance=instance)
|
||||
raise exc.HTTPBadRequest()
|
||||
|
||||
|
@ -23,6 +23,7 @@ from nova.api.openstack import extensions
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LE
|
||||
from nova.i18n import _LI
|
||||
import nova.network
|
||||
from nova.openstack.common import log as logging
|
||||
@ -81,7 +82,7 @@ class NetworkController(object):
|
||||
try:
|
||||
self._default_networks = self._get_default_networks()
|
||||
except Exception:
|
||||
LOG.exception(_("Failed to get default networks"))
|
||||
LOG.exception(_LE("Failed to get default networks"))
|
||||
|
||||
def _get_default_networks(self):
|
||||
project_id = CONF.neutron_default_tenant_id
|
||||
@ -120,8 +121,8 @@ class NetworkController(object):
|
||||
reservation = QUOTAS.reserve(context, networks=-1)
|
||||
except Exception:
|
||||
reservation = None
|
||||
LOG.exception(_("Failed to update usages deallocating "
|
||||
"network."))
|
||||
LOG.exception(_LE("Failed to update usages deallocating "
|
||||
"network."))
|
||||
|
||||
LOG.info(_LI("Deleting network with id %s"), id)
|
||||
|
||||
|
@ -606,8 +606,7 @@ class Controller(wsgi.Controller):
|
||||
msg = _('marker [%s] not found') % marker
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
except exception.FlavorNotFound:
|
||||
log_msg = _("Flavor '%s' could not be found ")
|
||||
LOG.debug(log_msg, search_opts['flavor'])
|
||||
LOG.debug("Flavor '%s' could not be found", search_opts['flavor'])
|
||||
# TODO(mriedem): Move to ObjectListBase.__init__ for empty lists.
|
||||
instance_list = objects.InstanceList(objects=[])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user