Pass kwargs to exception to get better formatted error message
This is to pass kwargs to VolumeNotFound/ImageNotFound/ VolumeMappingNotFound/ContainerNotFound, and to fix kwargs for QuotaResourceUnknown, to get better formatted error message. Change-Id: If625c1c1a0ad159cf9a1d76de1d53448b3532b8c
This commit is contained in:
parent
dd6e3f5dfa
commit
6ee2f97816
|
@ -519,7 +519,7 @@ class QuotaEngine(object):
|
|||
# Get the resource
|
||||
res = self._resources.get(resource)
|
||||
if not res or not hasattr(res, 'count'):
|
||||
raise exception.QuotaResourceUnknown(unknow=[resource])
|
||||
raise exception.QuotaResourceUnknown(unknown=[resource])
|
||||
|
||||
return res.count(context, project_id)
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ class Connection(object):
|
|||
query = add_identity_filter(query, container_id)
|
||||
count = query.delete()
|
||||
if count != 1:
|
||||
raise exception.ContainerNotFound(container_id)
|
||||
raise exception.ContainerNotFound(container=container_id)
|
||||
|
||||
def update_container(self, context, container_type, container_id, values):
|
||||
# NOTE(dtantsur): this can lead to very strange errors
|
||||
|
@ -308,7 +308,8 @@ class Connection(object):
|
|||
try:
|
||||
return query.one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeMappingNotFound(volume_mapping_uuid)
|
||||
raise exception.VolumeMappingNotFound(
|
||||
volume_mapping=volume_mapping_uuid)
|
||||
|
||||
def destroy_volume_mapping(self, context, volume_mapping_uuid):
|
||||
session = get_session()
|
||||
|
@ -336,7 +337,8 @@ class Connection(object):
|
|||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeMappingNotFound(volume_mapping_uuid)
|
||||
raise exception.VolumeMappingNotFound(
|
||||
volume_mapping=volume_mapping_uuid)
|
||||
|
||||
ref.update(values)
|
||||
return ref
|
||||
|
@ -368,7 +370,7 @@ class Connection(object):
|
|||
try:
|
||||
return query.one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeNotFound(volume_id)
|
||||
raise exception.VolumeNotFound(volume=volume_id)
|
||||
|
||||
def destroy_volume(self, context, volume_uuid):
|
||||
session = get_session()
|
||||
|
@ -377,7 +379,7 @@ class Connection(object):
|
|||
query = add_identity_filter(query, volume_uuid)
|
||||
count = query.delete()
|
||||
if count != 1:
|
||||
raise exception.VolumeNotFound(volume_uuid)
|
||||
raise exception.VolumeNotFound(volume=volume_uuid)
|
||||
|
||||
def update_volume(self, context, volume_uuid, values):
|
||||
# NOTE(dtantsur): this can lead to very strange errors
|
||||
|
@ -395,7 +397,7 @@ class Connection(object):
|
|||
try:
|
||||
ref = query.with_lockmode('update').one()
|
||||
except NoResultFound:
|
||||
raise exception.VolumeNotFound(volume_uuid)
|
||||
raise exception.VolumeNotFound(volume=volume_uuid)
|
||||
|
||||
ref.update(values)
|
||||
return ref
|
||||
|
@ -470,7 +472,7 @@ class Connection(object):
|
|||
query = add_identity_filter(query, uuid)
|
||||
count = query.delete()
|
||||
if count != 1:
|
||||
raise exception.ImageNotFound(uuid)
|
||||
raise exception.ImageNotFound(image=uuid)
|
||||
|
||||
def pull_image(self, context, values):
|
||||
# ensure defaults are present for new images
|
||||
|
|
Loading…
Reference in New Issue