From 88f34ce25bbda4bfc2f4bc174f25118e15bdea85 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Wed, 14 Jun 2017 16:16:50 +0800 Subject: [PATCH] Remove the redundant volume/snapshot check In DB layer, there are some redundant resource existing check. Such as "volume_metadata_get", it called @require_volume_exists twice at the same time. We should remove the redundant db query check to improve the performance. Change-Id: Ie8a5fe55c7ea4719acf01567beb717d8002ee917 Closes-bug: #1697885 --- cinder/db/sqlalchemy/api.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 7a08b750695..b21cfc944a0 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -2711,7 +2711,6 @@ def _volume_image_metadata_get_query(context, volume_id, session=None): @require_context -@require_volume_exists def _volume_user_metadata_get(context, volume_id, session=None): return _volume_x_metadata_get(context, volume_id, models.VolumeMetadata, session=session) @@ -2783,7 +2782,6 @@ def volume_metadata_delete(context, volume_id, key, meta_type): @require_context -@require_volume_exists @handle_db_data_error @_retry_on_deadlock def volume_metadata_update(context, volume_id, metadata, delete, meta_type): @@ -4752,7 +4750,6 @@ def _volume_glance_metadata_get(context, volume_id, session=None): @require_context -@require_volume_exists def volume_glance_metadata_get(context, volume_id): """Return the Glance metadata for the specified volume.""" @@ -4774,7 +4771,6 @@ def _volume_snapshot_glance_metadata_get(context, snapshot_id, session=None): @require_context -@require_snapshot_exists def volume_snapshot_glance_metadata_get(context, snapshot_id): """Return the Glance metadata for the specified snapshot.""" @@ -4862,7 +4858,6 @@ def volume_glance_metadata_copy_to_snapshot(context, snapshot_id, volume_id): @require_context -@require_volume_exists def volume_glance_metadata_copy_from_volume_to_volume(context, src_volume_id, volume_id):