try:
update['status'] = body['status'].lower()
except (TypeError, KeyError):
- raise exc.HTTPBadRequest("Must specify 'status'")
+ raise exc.HTTPBadRequest(explanation=_("Must specify 'status'"))
if update['status'] not in self.valid_status:
- raise exc.HTTPBadRequest("Must specify a valid status")
+ raise exc.HTTPBadRequest(
+ explanation=_("Must specify a valid status"))
return update
def authorize(self, context, action_name):
try:
self._update(context, id, update)
except exception.NotFound as e:
- raise exc.HTTPNotFound(e)
+ raise exc.HTTPNotFound(explanation=e.msg)
notifier.info(context, self.collection + '.reset_status.end',
notifier_info)
valid = True
update['attach_status'] = attach_status.lower()
if update['attach_status'] not in self.valid_attach_status:
- raise exc.HTTPBadRequest("Must specify a valid attach status")
+ raise exc.HTTPBadRequest(
+ explanation=_("Must specify a valid attach status"))
if migration_status:
valid = True
update['migration_status'] = migration_status.lower()
if update['migration_status'] not in self.valid_migration_status:
- raise exc.HTTPBadRequest("Must specify a valid migration "
- "status")
+ raise exc.HTTPBadRequest(
+ explanation=_("Must specify a valid migration status"))
if update['migration_status'] == 'none':
update['migration_status'] = None
if not valid:
- raise exc.HTTPBadRequest("Must specify 'status', 'attach_status' "
- "or 'migration_status' for update.")
+ raise exc.HTTPBadRequest(
+ explanation=_("Must specify 'status', 'attach_status' "
+ "or 'migration_status' for update."))
return update
@wsgi.action('os-force_detach')
try:
host = params['host']
except KeyError:
- raise exc.HTTPBadRequest("Must specify 'host'")
+ raise exc.HTTPBadRequest(explanation=_("Must specify 'host'"))
force_host_copy = params.get('force_host_copy', False)
if isinstance(force_host_copy, basestring):
try:
force_host_copy = strutils.bool_from_string(force_host_copy,
strict=True)
except ValueError:
- raise exc.HTTPBadRequest("Bad value for 'force_host_copy'")
+ raise exc.HTTPBadRequest(
+ explanation=_("Bad value for 'force_host_copy'"))
elif not isinstance(force_host_copy, bool):
- raise exc.HTTPBadRequest("'force_host_copy' not string or bool")
+ raise exc.HTTPBadRequest(
+ explanation=_("'force_host_copy' not string or bool"))
self.volume_api.migrate_volume(context, volume, host, force_host_copy)
return webob.Response(status_int=202)
try:
new_volume_id = params['new_volume']
except KeyError:
- raise exc.HTTPBadRequest("Must specify 'new_volume'")
+ raise exc.HTTPBadRequest(
+ explanation=_("Must specify 'new_volume'"))
try:
new_volume = self._get(context, new_volume_id)
except exception.NotFound:
disabled = True
status = "disabled"
else:
- raise webob.exc.HTTPNotFound("Unknown action")
+ raise webob.exc.HTTPNotFound(explanation=_("Unknown action"))
try:
host = body['host']
try:
svc = db.service_get_by_args(context, host, binary_key)
if not svc:
- raise webob.exc.HTTPNotFound('Unknown service')
+ raise webob.exc.HTTPNotFound(explanation=_('Unknown service'))
db.service_update(context, svc['id'], ret_val)
except exception.ServiceNotFound:
- raise webob.exc.HTTPNotFound("service not found")
+ raise webob.exc.HTTPNotFound(explanation=_("service not found"))
ret_val.update({'host': host, 'service': service,
'binary': binary, 'status': status})
try:
connector = body['os-initialize_connection']['connector']
except KeyError:
- raise webob.exc.HTTPBadRequest("Must specify 'connector'")
+ raise webob.exc.HTTPBadRequest(
+ explanation=_("Must specify 'connector'"))
try:
info = self.volume_api.initialize_connection(context,
volume,
connector)
except exception.VolumeBackendAPIException as error:
msg = _("Unable to fetch connection information from backend.")
- raise webob.exc.HTTPInternalServerError(msg)
+ raise webob.exc.HTTPInternalServerError(explanation=msg)
return {'connection_info': info}
try:
connector = body['os-terminate_connection']['connector']
except KeyError:
- raise webob.exc.HTTPBadRequest("Must specify 'connector'")
+ raise webob.exc.HTTPBadRequest(
+ explanation=_("Must specify 'connector'"))
try:
self.volume_api.terminate_connection(context, volume, connector)
except exception.VolumeBackendAPIException as error: