From 7c2cd41ca2f8843fcc5931b308f1bf13a8b31606 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 23 Mar 2017 16:39:58 -0400 Subject: [PATCH] Change checking cinder v1 to check v2 in panels In general, in the case where there is no cinder v1 endpoint created (or deleted - use openstack service delete cinder to reproduce) certain volume related menu entries are not displayed This patch add a a new function to check cinder v2/v3 endpoints instead of only checking the v1 endpoint in instance launch model. Also, in the image panel, instead of checking v1 endpoint, it should check v2 and v3 as well. Change-Id: I642b2f62bb9502f958593c9fcad76e21ee1c80ad Closes-Bug: #1670789 (cherry picked from commit 5ced2f87ef3b480f9d795a3c1ba648a1d0a072df) --- .../launch-instance/launch-instance-model.service.js | 12 +++++++++++- .../launch-instance-model.service.spec.js | 4 ++++ .../app/core/images/actions/create-volume.service.js | 8 +++++++- ...70789-volume-v2-v3-endpoint-e48a0a62f85b5207.yaml | 10 ++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1670789-volume-v2-v3-endpoint-e48a0a62f85b5207.yaml 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 dbe2b00028..f03ddb2df1 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 @@ -546,7 +546,17 @@ var volumeSnapshotDeferred = $q.defer(); serviceCatalog .ifTypeEnabled('volume') - .then(onVolumeServiceEnabled, resolvePromises); + .then(onVolumeServiceEnabled, onCheckVolumeV2); + function onCheckVolumeV2() { + serviceCatalog + .ifTypeEnabled('volumev2') + .then(onVolumeServiceEnabled, onCheckVolumeV3); + } + function onCheckVolumeV3() { + serviceCatalog + .ifTypeEnabled('volumev3') + .then(onVolumeServiceEnabled, resolvePromises); + } function onVolumeServiceEnabled() { model.volumeBootable = true; novaExtensions diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js index 133b336173..87b07fe4dc 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js @@ -244,6 +244,10 @@ deferred.resolve(); } else if (theType === 'volume' && cinderEnabled) { deferred.resolve(); + } else if (theType === 'volumev2' && cinderEnabled) { + deferred.resolve(); + } else if (theType === 'volumev3' && cinderEnabled) { + deferred.resolve(); } else { deferred.reject(); } diff --git a/openstack_dashboard/static/app/core/images/actions/create-volume.service.js b/openstack_dashboard/static/app/core/images/actions/create-volume.service.js index 594ecf1fcf..e80daad8e6 100644 --- a/openstack_dashboard/static/app/core/images/actions/create-volume.service.js +++ b/openstack_dashboard/static/app/core/images/actions/create-volume.service.js @@ -72,7 +72,13 @@ function initAction() { createVolumePromise = policy.ifAllowed({rules: [['volume', 'volume:create']]}); - volumeServiceEnabledPromise = serviceCatalog.ifTypeEnabled('volume'); + if (serviceCatalog.ifTypeEnabled('volume') || + serviceCatalog.ifTypeEnabled('volumev2') || + serviceCatalog.ifTypeEnabled('volumev3')) { + volumeServiceEnabledPromise = true; + } else { + volumeServiceEnabledPromise = false; + } } function allowed(image) { diff --git a/releasenotes/notes/bug-1670789-volume-v2-v3-endpoint-e48a0a62f85b5207.yaml b/releasenotes/notes/bug-1670789-volume-v2-v3-endpoint-e48a0a62f85b5207.yaml new file mode 100644 index 0000000000..6642d86c56 --- /dev/null +++ b/releasenotes/notes/bug-1670789-volume-v2-v3-endpoint-e48a0a62f85b5207.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + Previously horizon assumes only ``volume`` as an endpoint for the Cinder + regardless of the API version. As a result, if deployers configure + Cinder v2/v3 API endpoint as ``volumev2`` or ``volumev3``, Volume related + menus -- "Create Volume from instance snapshot" and "Create instance from + Volume" -- were not displayed. Horizon now checks the availability of the + Block Storage service by looking for all posible endpoints ``volume``, + ``volumev2`` and ``volumev3``.