Honor Nova's restriction for bdm fields
Nova does not allow None values for bdm fields. However it stores them
in image metadata for volume bdm during snapshot operation of volume
backed instance. Ec2Api sends them back to Nova during run instance
operation, which violates Nova's restriction.
Here we cut out None values from image bdms before use it.
Change-Id: Ice913c935e288f1cb615443324c05ca3c31efca6
(cherry picked from commit 239464ab74
)
This commit is contained in:
parent
d4b5010acc
commit
ad4978738a
|
@ -40,7 +40,7 @@ S3_URL=`openstack endpoint list --service s3 --interface public --os-identity-ap
|
|||
# reinstalling can help
|
||||
aws --version
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
sudo pip install awscli --upgrade
|
||||
sudo pip install awscli --upgrade --upgrade-strategy only-if-needed
|
||||
aws --version
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
die $LINENO "Looks like awscli is not correctly installed."
|
||||
|
|
|
@ -7,3 +7,5 @@ enable_service n-crt
|
|||
enable_service ec2-api
|
||||
enable_service ec2-api-metadata
|
||||
enable_service ec2-api-s3
|
||||
|
||||
IPSEC_PACKAGE=strongswan
|
||||
|
|
|
@ -1003,6 +1003,8 @@ def _build_block_device_mapping(context, block_device_mapping, os_image):
|
|||
|
||||
_populate_parsed_bdm_parameter(bdm, short_root_device_name)
|
||||
else:
|
||||
image_bdm = {k: v for k, v in six.iteritems(image_bdm)
|
||||
if v is not None}
|
||||
image_bdm.update(bdm)
|
||||
bdm = image_bdm
|
||||
|
||||
|
|
|
@ -1508,7 +1508,8 @@ class InstancePrivateTestCase(test_base.BaseTestCase):
|
|||
'device_name': '/dev/vda',
|
||||
'source_type': 'snapshot',
|
||||
'snapshot_id': fakes.ID_OS_SNAPSHOT_1,
|
||||
'delete_on_termination': True},
|
||||
'delete_on_termination': True,
|
||||
'disk_bus': None},
|
||||
{'device_name': 'vdb',
|
||||
'source_type': 'snapshot',
|
||||
'snapshot_id': fakes.random_os_id(),
|
||||
|
|
Loading…
Reference in New Issue