From: Chamarty Date: Fri, 14 Apr 2017 20:11:20 +0000 (-0400) Subject: Fix ordering of elements for Openstack block device mapping X-Git-Tag: v2.0.0~3^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=bfb8869ca4f499c6ce2802cfb29f78e5482db6b4;p=osm%2FSO.git Fix ordering of elements for Openstack block device mapping Change-Id: I3904241acd6190e86f9dfb56c521d2badaf35904 Signed-off-by: Chamarty --- diff --git a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py index be7a969f..e886bb2d 100644 --- a/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py +++ b/rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/utils/compute.py @@ -266,10 +266,17 @@ class ComputeUtils(object): kwargs = dict() if vdu_params.has_field('volumes'): kwargs['block_device_mapping_v2'] = list() + bootvol_list = list() + othervol_list = list() # Ignore top-level image kwargs['image_id'] = "" for volume in vdu_params.volumes: - kwargs['block_device_mapping_v2'].append(self.make_vdu_volume_args(volume, vdu_params)) + if 'boot_priority' in volume: + bootvol_list.append(self.make_vdu_volume_args(volume, vdu_params)) + else: + othervol_list.append(self.make_vdu_volume_args(volume, vdu_params)) + # Sort block_device_mapping_v2 list by boot index, Openstack does not seem to respecting order by boot index + kwargs['block_device_mapping_v2'] = sorted(bootvol_list, key=lambda k: k['boot_index']) + othervol_list return kwargs def make_vdu_network_args(self, vdu_params):