From 13682d018824544f0c6f54ed44645c8757f1c7cf Mon Sep 17 00:00:00 2001 From: Joel Coffman Date: Mon, 17 Aug 2015 11:07:32 -0400 Subject: [PATCH] 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 --- cinder/volume/volume_types.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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): -- 2.45.2