"""The QoS specs extension"""
+import six
import webob
from cinder.api import extensions
try:
qos_specs.get_qos_specs(context, specs_id)
except exception.NotFound as ex:
- raise webob.exc.HTTPNotFound(explanation=unicode(ex))
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(ex))
class QoSSpecsController(wsgi.Controller):
self._notify_qos_specs_error(context,
'qos_specs.create',
notifier_err)
- raise webob.exc.HTTPBadRequest(explanation=err)
+ raise webob.exc.HTTPBadRequest(explanation=six.text_type(err))
except exception.QoSSpecsExists as err:
notifier_err = dict(name=name, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.create',
notifier_err)
- raise webob.exc.HTTPConflict(explanation=err)
+ raise webob.exc.HTTPConflict(explanation=six.text_type(err))
except exception.QoSSpecsCreateFailed as err:
notifier_err = dict(name=name, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.create',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return self._view_builder.detail(req, spec)
self._notify_qos_specs_error(context,
'qos_specs.update',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.InvalidQoSSpecs as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.update',
notifier_err)
- raise webob.exc.HTTPBadRequest(explanation=err)
+ raise webob.exc.HTTPBadRequest(explanation=six.text_type(err))
except exception.QoSSpecsUpdateFailed as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.update',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return body
try:
spec = qos_specs.get_qos_specs(context, id)
except exception.QoSSpecsNotFound as err:
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
return self._view_builder.detail(req, spec)
self._notify_qos_specs_error(context,
'qos_specs.delete',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsInUse as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
self._notify_qos_specs_error(context,
'qos_specs.delete_keys',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsKeyNotFound as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.delete_keys',
notifier_err)
- raise webob.exc.HTTPBadRequest(explanation=err)
+ raise webob.exc.HTTPBadRequest(explanation=six.text_type(err))
return webob.Response(status_int=202)
self._notify_qos_specs_error(context,
'qos_specs.associations',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.CinderException as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.associations',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return self._view_builder.associations(req, associates)
self._notify_qos_specs_error(context,
'qos_specs.associate',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsNotFound as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.associate',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.InvalidVolumeType as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
self._notify_qos_specs_error(context,
'qos_specs.associate',
notifier_err)
- raise webob.exc.HTTPBadRequest(explanation=err)
+ raise webob.exc.HTTPBadRequest(explanation=six.text_type(err))
except exception.QoSSpecsAssociateFailed as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.associate',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return webob.Response(status_int=202)
self._notify_qos_specs_error(context,
'qos_specs.disassociate',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsNotFound as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.disassociate',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsDisassociateFailed as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.disassociate',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return webob.Response(status_int=202)
self._notify_qos_specs_error(context,
'qos_specs.disassociate_all',
notifier_err)
- raise webob.exc.HTTPNotFound(explanation=err)
+ raise webob.exc.HTTPNotFound(explanation=six.text_type(err))
except exception.QoSSpecsDisassociateFailed as err:
notifier_err = dict(id=id, error_message=err)
self._notify_qos_specs_error(context,
'qos_specs.disassociate_all',
notifier_err)
- raise webob.exc.HTTPInternalServerError(explanation=err)
+ raise webob.exc.HTTPInternalServerError(
+ explanation=six.text_type(err))
return webob.Response(status_int=202)