From: Joel Coffman Date: Mon, 17 Aug 2015 15:07:32 +0000 (-0400) Subject: Refactor to remove duplicate code X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=13682d018824544f0c6f54ed44645c8757f1c7cf;p=openstack-build%2Fcinder-build.git Refactor to remove duplicate code This change reuses the get_volume_type_encryption function for the implementation of the is_encrypted function. Change-Id: Ie6434016840c20229b3a32b676aa8fc994f9362b --- diff --git a/cinder/volume/volume_types.py b/cinder/volume/volume_types.py index 8aa9b2916..902ecfc07 100644 --- a/cinder/volume/volume_types.py +++ b/cinder/volume/volume_types.py @@ -211,11 +211,7 @@ def remove_volume_type_access(context, volume_type_id, project_id): def is_encrypted(context, volume_type_id): - if volume_type_id is None: - return False - - encryption = db.volume_type_encryption_get(context, volume_type_id) - return encryption is not None + return get_volume_type_encryption(context, volume_type_id) is not None def get_volume_type_encryption(context, volume_type_id):