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 5ced2f87ef)
This commit is contained in:
Lucas H. Xu 2017-03-23 16:39:58 -04:00 committed by Akihiro Motoki
parent 3ee8fdae2c
commit 7c2cd41ca2
4 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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();
}

View File

@ -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) {

View File

@ -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``.