Parse live data with correct key 'readonly'

Cinder returns the volume infos with key 'readonly',
not 'read_only', so parse live data with correct key
'readonly' for volume resource.

Change-Id: If19db3129f23a6cb9d19e6744c4ffc4522166426
Closes-Bug: #1712041
This commit is contained in:
huangtianhua 2017-08-22 15:31:14 +08:00
parent 87208f3d02
commit 72be5266ee
2 changed files with 3 additions and 3 deletions

View File

@ -676,8 +676,8 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
if (resource_data.get(self.METADATA) and
resource_data.get(self.METADATA).get(
self.READ_ONLY) is not None):
read_only = resource_data.get(self.METADATA).pop(self.READ_ONLY)
'readonly') is not None):
read_only = resource_data.get(self.METADATA).pop('readonly')
volume_reality.update({self.READ_ONLY: read_only})
old_vt = self.data().get(self.VOLUME_TYPE)

View File

@ -1318,7 +1318,7 @@ class CinderVolumeTest(vt_base.BaseVolumeTest):
'availability_zone': 'nova',
'snapshot_id': None,
'size': 1,
'metadata': {'test': 'test_value', 'read_only': False},
'metadata': {'test': 'test_value', 'readonly': False},
'consistencygroup_id': '4444',
'volume_image_metadata': {'image_id': '1234',
'image_name': 'test'},