From 9a3c264ccdff08e48a2b5f5d6fa3eb36df77414f Mon Sep 17 00:00:00 2001 From: Chamarty Date: Fri, 14 Apr 2017 16:11:20 -0400 Subject: [PATCH] Fix ordering of elements for Openstack block device mapping Change-Id: I3904241acd6190e86f9dfb56c521d2badaf35904 Signed-off-by: Chamarty --- .../rift/rwcal/openstack/utils/compute.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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): -- 2.25.1