From 126df2b1b86da721c76079ca21047ba7ac9cdbf4 Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Wed, 14 Dec 2016 14:39:12 +0000 Subject: [PATCH] Use block device mapping v2 for boot from vol This bug originally manifested in 2.1.1 - when booting from volume Horizon hardcodes the device name to 'vda', which is incompatible with OVM/Xen. Our original fix was made in commit 5f168859 (openstack-horizon), which was based on info found in https://bugs.launchpad.net/nova/+bug/1560965. The above bug is still open as of writing, and the original fix needs to be refactored as the base code changes between releases. For some unknown reason create_instance.py seems to be no longer used in this flow, it's now launch-instance-model.service.js. This opens new issues as the js file hardcodes BDM v1 for volume->volume, but not image->volume. To complicate things further, patching the function for volume->volume to use BDM v2 seems to work, but dropping the device_name from the image->volume API call as eblock has done in the bug seems to not work. TL;DR This patch makes volume->volume from Horizon work for Xen. image->volume for Xen is still broken and unclear if worked previously. Bug DB: 25130333 --- .../launch-instance/launch-instance-model.service.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js index 3959958..b149ce0 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js @@ -577,14 +577,17 @@ } function setFinalSpecBootFromVolumeDevice(finalSpec, sourceType) { - finalSpec.block_device_mapping = {}; - finalSpec.block_device_mapping[finalSpec.vol_device_name] = [ - finalSpec.source_id, - ':', - sourceType, - '::', - finalSpec.vol_delete_on_instance_delete - ].join(''); + finalSpec.block_device_mapping_v2 = []; + finalSpec.block_device_mapping_v2.push( + { + 'source_type': SOURCE_TYPE_VOLUME, + 'destination_type': SOURCE_TYPE_VOLUME, + 'delete_on_termination': finalSpec.vol_delete_on_instance_delete, + 'uuid': finalSpec.source_id, + 'boot_index': '0', + 'volume_size': finalSpec.vol_size + } + ); // Source ID must be empty for API finalSpec.source_id = ''; -- 2.7.4