Volume type with encryption comparison

In volume retype with encryption, comparison of
volume types with same encryption will returns
true, instead of false because of unique field
'encryption_id', so ignore this field before
comparing.

Change-Id: I065b904bc881324de79ce59afd5bb97a97ea1b85
Closes-Bug: 1700741
This commit is contained in:
Vivek Soni 2017-06-28 02:54:30 -07:00
parent 959f9825f8
commit 32ea9339ea
2 changed files with 4 additions and 7 deletions

View File

@ -414,11 +414,9 @@ class VolumeTypeTestCase(test.TestCase):
# And add encryption for good measure
enc_keyvals1 = {'cipher': 'c1', 'key_size': 256, 'provider': 'p1',
'control_location': 'front-end',
'encryption_id': 'uuid1'}
'control_location': 'front-end'}
enc_keyvals2 = {'cipher': 'c1', 'key_size': 128, 'provider': 'p1',
'control_location': 'front-end',
'encryption_id': 'uuid2'}
'control_location': 'front-end'}
db.volume_type_encryption_create(self.ctxt, type_ref1['id'],
enc_keyvals1)
db.volume_type_encryption_create(self.ctxt, type_ref2['id'],
@ -444,8 +442,7 @@ class VolumeTypeTestCase(test.TestCase):
'control_location': (None, 'front-end'),
'deleted': (None, False),
'key_size': (None, 256),
'provider': (None, 'p1'),
'encryption_id': (None, 'uuid1')},
'provider': (None, 'p1')},
diff['encryption'])
def test_encryption_create(self):

View File

@ -37,7 +37,7 @@ CONF = cfg.CONF
LOG = logging.getLogger(__name__)
QUOTAS = quota.QUOTAS
ENCRYPTION_IGNORED_FIELDS = ['volume_type_id', 'created_at', 'updated_at',
'deleted_at']
'deleted_at', 'encryption_id']
def create(context,