Add check whether nova is enable or not in aggregate panel

At the moment, aggregate panel has a check whether nova extension
is enable or not. However it doesn't check nova is enable or not.
So, when operator use non nova, error always occur by this check
method. Therefore, this patch will add a check whether nova is
enable or not.

Closes-Bug: #1591920

Change-Id: I5ad37f16f70f1ac9b95c49b1363d1b23abbb1b94
This commit is contained in:
Kenji Ishii 2016-06-13 17:54:53 +09:00
parent ab878c4a5b
commit f20b3b1e60
1 changed files with 4 additions and 2 deletions

View File

@ -16,7 +16,7 @@ from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.api import nova
from openstack_dashboard import api
LOG = logging.getLogger(__name__)
@ -30,7 +30,9 @@ class Aggregates(horizon.Panel):
# extend basic permission-based check with a check to see whether
# the Aggregates extension is even enabled in nova
try:
if not nova.extension_supported('Aggregates', context['request']):
request = context['request']
if not (api.base.is_service_enabled(request, 'compute') and
api.nova.extension_supported('Aggregates', request)):
return False
except Exception:
LOG.error("Call to list supported extensions failed. This is "