Skip to content

Commit

Permalink
Merge "Fix type change in bootable setting of volume view"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 30, 2013
2 parents 410a018 + 5d49939 commit e7c666f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
8 changes: 7 additions & 1 deletion cinder/api/v1/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ def _translate_volume_summary_view(context, vol, image_id=None):
d['size'] = vol['size']
d['availability_zone'] = vol['availability_zone']
d['created_at'] = vol['created_at']
d['bootable'] = vol['bootable']

# Need to form the string true/false explicitly here to
# maintain our API contract
if vol['bootable']:
d['bootable'] = 'true'
else:
d['bootable'] = 'false'

d['attachments'] = []
if vol['attach_status'] == 'attached':
Expand Down
32 changes: 16 additions & 16 deletions cinder/tests/api/v1/test_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_volume_create(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -175,7 +175,7 @@ def test_volume_create_with_image_id(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'image_id': test_id,
'snapshot_id': None,
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_volume_update(self):
'host_name': None,
'device': '/'
}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -276,7 +276,7 @@ def test_volume_update_metadata(self):
'host_name': None,
'device': '/'
}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -323,7 +323,7 @@ def test_volume_update_with_admin_metadata(self):
'host_name': None,
'device': '/'
}],
'bootable': False,
'bootable': 'false',
'volume_type': 'None',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_volume_list(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -412,7 +412,7 @@ def test_volume_list_with_admin_metadata(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'None',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -440,7 +440,7 @@ def test_volume_list_detail(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -477,7 +477,7 @@ def test_volume_list_detail_with_admin_metadata(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'None',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -627,7 +627,7 @@ def test_volume_show(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand All @@ -652,7 +652,7 @@ def stub_volume_get(self, context, volume_id):
'availability_zone': 'fakeaz',
'display_name': 'displayname',
'attachments': [],
'bootable': False,
'bootable': 'false',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -681,7 +681,7 @@ def stub_volume_get(self, context, volume_id):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': True,
'bootable': 'true',
'volume_type': 'vol_type_name',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -753,7 +753,7 @@ def test_volume_show_with_admin_metadata(self):
'host_name': None,
'id': '1',
'volume_id': '1'}],
'bootable': False,
'bootable': 'false',
'volume_type': 'None',
'snapshot_id': None,
'source_volid': None,
Expand Down Expand Up @@ -884,7 +884,7 @@ def test_volume_show_create_serializer(self):
status='vol_status',
size=1024,
availability_zone='vol_availability',
bootable=False,
bootable='false',
created_at=datetime.datetime.now(),
attachments=[dict(id='vol_id',
volume_id='vol_id',
Expand All @@ -909,7 +909,7 @@ def test_volume_index_detail_serializer(self):
status='vol1_status',
size=1024,
availability_zone='vol1_availability',
bootable=True,
bootable='true',
created_at=datetime.datetime.now(),
attachments=[dict(id='vol1_id',
volume_id='vol1_id',
Expand All @@ -926,7 +926,7 @@ def test_volume_index_detail_serializer(self):
status='vol2_status',
size=1024,
availability_zone='vol2_availability',
bootable=False,
bootable='true',
created_at=datetime.datetime.now(),
attachments=[dict(id='vol2_id',
volume_id='vol2_id',
Expand Down

0 comments on commit e7c666f

Please sign in to comment.