Merge "Skip none value attributes for ec2 image bdm output."

This commit is contained in:
Jenkins
2014-08-13 11:29:58 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 2 deletions

View File

@@ -172,7 +172,7 @@ def _format_block_device_mapping(bdm):
('deleteOnTermination', 'delete_on_termination'))
ebs = {}
for name, k in ebs_keys:
if k in bdm:
if bdm.get(k) is not None:
if k == 'snapshot_id':
ebs[name] = ec2utils.id_to_ec2_snap_id(bdm[k])
elif k == 'volume_id':

View File

@@ -1491,7 +1491,8 @@ class CloudTestCase(test.TestCase):
mappings2 = [{'device': '/dev/sda1', 'virtual': 'root'}]
block_device_mapping2 = [{'device_name': '/dev/sdb1',
'snapshot_id': 'ccec42a2-c220-4806-b762-6b12fbb592e7'}]
'snapshot_id': 'ccec42a2-c220-4806-b762-6b12fbb592e7',
'volume_id': None}]
image2 = {
'id': '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6',
'name': 'fake_name',