Merge "Return BadRequest for invalid unicode names (continued)"

This commit is contained in:
Jenkins 2016-03-02 12:26:11 +00:00 committed by Gerrit Code Review
commit 4504fdfa75
2 changed files with 10 additions and 0 deletions

View File

@ -690,6 +690,7 @@ def _quota_class_get_all_by_resource(context, resource, session):
return result
@handle_db_data_error
@require_admin_context
def quota_class_create(context, class_name, resource, limit):
quota_class_ref = models.QuotaClass()
@ -3001,6 +3002,7 @@ def _volume_type_extra_specs_get_item(context, volume_type_id, key,
return result
@handle_db_data_error
@require_context
def volume_type_extra_specs_update_or_create(context, volume_type_id,
specs):
@ -3065,6 +3067,10 @@ def qos_specs_create(context, values):
spec_entry = models.QualityOfServiceSpecs()
spec_entry.update(item)
spec_entry.save(session=session)
except db_exc.DBDataError:
msg = _('Error writing field to database')
LOG.exception(msg)
raise exception.Invalid(msg)
except Exception as e:
raise db_exc.DBError(e)

View File

@ -79,6 +79,10 @@ def create(context, name, specs=None):
try:
qos_specs_ref = db.qos_specs_create(context, values)
except db_exc.DBDataError:
msg = _('Error writing field to database')
LOG.exception(msg)
raise exception.Invalid(msg)
except db_exc.DBError:
LOG.exception(_LE('DB error:'))
raise exception.QoSSpecsCreateFailed(name=name,