]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Refactor to remove duplicate code
authorJoel Coffman <joel.coffman@jhuapl.edu>
Mon, 17 Aug 2015 15:07:32 +0000 (11:07 -0400)
committerJoel Coffman <joel.coffman@jhuapl.edu>
Mon, 17 Aug 2015 19:16:47 +0000 (15:16 -0400)
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

index 8aa9b2916b0f6e80724e53eb7a02639f6c38e498..902ecfc07bcc79d3f865968b57cac10601ead00f 100644 (file)
@@ -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):