Reorg of files
Paving the way for STX-GUI by putting files in directories that better explain their scope. - starlingx_dashboard/horizon: Hacks done to the horizon framework - starlingx_dashboard/local: STX-specific settings - starlingx_dashboard/api: API wrappers for stx clients - starlingx_dashboard/dashboards: panels - starlingx_dashboard/enabled: enable panels - starlingx_dashboard/static: static assets, e.g. css, images - starlingx_dashboard/locale: translation strings - starlingx_dashboard/theme: stx theme Change-Id: I7c8e66b657143c067be278de4b1c128b9fd25252 Signed-off-by: Eddie Ramirez <eddie.ramirez@intel.com>
This commit is contained in:
parent
a736b7ed44
commit
a814981a9f
|
@ -17,22 +17,6 @@ nosetests.xml
|
|||
pep8.txt
|
||||
pylint.txt
|
||||
# Files created by releasenotes build
|
||||
releasenotes/build
|
||||
reports
|
||||
openstack_dashboard/local/*
|
||||
!openstack_dashboard/local/local_settings.py.example
|
||||
!openstack_dashboard/local/enabled/_50__settings.py.example
|
||||
!openstack_dashboard/local/local_settings.d
|
||||
openstack_dashboard/local/local_settings.d/*
|
||||
!openstack_dashboard/local/local_settings.d/*.example
|
||||
openstack_dashboard/test/.secret_key_store
|
||||
openstack_dashboard/test/integration_tests/local-horizon.conf
|
||||
openstack_dashboard/test/integration_tests/test_reports/
|
||||
openstack_dashboard/wsgi/horizon.wsgi
|
||||
doc/build/
|
||||
doc/source/sourcecode
|
||||
/static/
|
||||
integration_tests_screenshots/
|
||||
.venv
|
||||
.tox
|
||||
node_modules
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
from ceilometerclient import client as ceilometer_client
|
||||
from django.conf import settings
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
|
||||
class Pipeline(base.APIResourceWrapper):
|
||||
"""Represents one Ceilometer pipeline entry."""
|
||||
|
||||
_attrs = ['name', 'enabled', 'meters', 'location', 'max_bytes',
|
||||
'backup_count', 'compress']
|
||||
|
||||
def __init__(self, apipipeline):
|
||||
super(Pipeline, self).__init__(apipipeline)
|
||||
|
||||
|
||||
@memoized
|
||||
def ceilometerclient(request):
|
||||
"""Initialization of Ceilometer client."""
|
||||
|
||||
endpoint = base.url_for(request, 'metering')
|
||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||
return ceilometer_client.Client('2', endpoint,
|
||||
token=(lambda: request.user.token.id),
|
||||
insecure=insecure,
|
||||
cacert=cacert)
|
||||
|
||||
|
||||
def pipeline_list(request):
|
||||
"""List the configured pipeline."""
|
||||
pipeline_entries = ceilometerclient(request).pipelines.list()
|
||||
pipelines = [Pipeline(p) for p in pipeline_entries]
|
||||
return pipelines
|
||||
|
||||
|
||||
def pipeline_update(request, pipeline_name, some_dict):
|
||||
pipeline = ceilometerclient(request).pipelines.update(pipeline_name,
|
||||
**some_dict)
|
||||
if not pipeline:
|
||||
raise ValueError(
|
||||
'No match found for pipeline_name "%s".' % pipeline_name)
|
||||
return Pipeline(pipeline)
|
|
@ -1,187 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from cephclient import wrapper
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO(wrs) this can be instancized once, or will need to pass request per
|
||||
# user?
|
||||
def cephwrapper():
|
||||
return wrapper.CephWrapper()
|
||||
|
||||
|
||||
class Monitor(base.APIDictWrapper):
|
||||
__attrs = ['host', 'rank']
|
||||
|
||||
def __init__(self, apidict):
|
||||
super(Monitor, self).__init__(apidict)
|
||||
|
||||
|
||||
class OSD(base.APIDictWrapper):
|
||||
__attrs = ['id', 'name', 'host', 'status']
|
||||
|
||||
def __init__(self, apidict):
|
||||
super(OSD, self).__init__(apidict)
|
||||
|
||||
|
||||
class Cluster(base.APIDictWrapper):
|
||||
_attrs = ['fsid', 'status', 'health', 'detail']
|
||||
|
||||
def __init__(self, apidict):
|
||||
super(Cluster, self).__init__(apidict)
|
||||
|
||||
|
||||
class Storage(base.APIDictWrapper):
|
||||
_attrs = ['total', 'used', 'available',
|
||||
'writes_per_sec', 'operations_per_sec']
|
||||
|
||||
def __init__(self, apidict):
|
||||
super(Storage, self).__init__(apidict)
|
||||
|
||||
|
||||
def _Bytes_to_MiB(value_B):
|
||||
return (value_B / (1024 * 1024))
|
||||
|
||||
|
||||
def _Bytes_to_GiB(value_B):
|
||||
return (value_B / (1024 * 1024 * 1024))
|
||||
|
||||
|
||||
def cluster_get():
|
||||
# the json response doesn't give all the information
|
||||
response, text_body = cephwrapper().health(body='text')
|
||||
# ceph is not up, raise exception
|
||||
if not response.ok:
|
||||
response.raise_for_status()
|
||||
health_info = text_body.split(' ', 1)
|
||||
|
||||
# if health is ok, there will be no details so just show HEALTH_OK
|
||||
if len(health_info) > 1:
|
||||
detail = health_info[1]
|
||||
else:
|
||||
detail = health_info[0]
|
||||
|
||||
response, cluster_uuid = cephwrapper().fsid(body='text')
|
||||
if not response.ok:
|
||||
cluster_uuid = None
|
||||
|
||||
cluster = {
|
||||
'fsid': cluster_uuid,
|
||||
'health': health_info[0],
|
||||
'detail': detail,
|
||||
}
|
||||
|
||||
return Cluster(cluster)
|
||||
|
||||
|
||||
def storage_get():
|
||||
# # Space info
|
||||
response, body = cephwrapper().df(body='json')
|
||||
# return no space info
|
||||
if not response.ok:
|
||||
response.raise_for_status()
|
||||
stats = body['output']['stats']
|
||||
space = {
|
||||
'total': _Bytes_to_GiB(stats['total_bytes']),
|
||||
'used': _Bytes_to_MiB(stats['total_used_bytes']),
|
||||
'available': _Bytes_to_GiB(stats['total_avail_bytes']),
|
||||
}
|
||||
|
||||
# # I/O info
|
||||
response, body = cephwrapper().osd_pool_stats(body='json',
|
||||
name='cinder-volumes')
|
||||
if not response.ok:
|
||||
response.raise_for_status()
|
||||
stats = body['output'][0]['client_io_rate']
|
||||
# not showing reads/sec at the moment
|
||||
# reads_per_sec = stats['read_bytes_sec'] if (
|
||||
# 'read_bytes_sec' in stats) else 0
|
||||
writes_per_sec = stats['write_bytes_sec'] if (
|
||||
'write_bytes_sec' in stats) else 0
|
||||
operations_per_sec = stats['op_per_sec'] if ('op_per_sec' in stats) else 0
|
||||
io = {
|
||||
'writes_per_sec': writes_per_sec / 1024,
|
||||
'operations_per_sec': operations_per_sec
|
||||
}
|
||||
|
||||
storage = {}
|
||||
storage.update(space)
|
||||
storage.update(io)
|
||||
|
||||
return Storage(storage)
|
||||
|
||||
|
||||
def _get_quorum_status(mon, quorums):
|
||||
if mon['rank'] in quorums:
|
||||
status = 'up'
|
||||
else:
|
||||
status = 'down'
|
||||
return status
|
||||
|
||||
|
||||
def monitor_list():
|
||||
response, body = cephwrapper().mon_dump(body='json')
|
||||
# return no monitors info
|
||||
if not response.ok:
|
||||
response.raise_for_status()
|
||||
|
||||
quorums = body['output']['quorum']
|
||||
|
||||
mons = []
|
||||
for mon in body['output']['mons']:
|
||||
status = _get_quorum_status(mon, quorums)
|
||||
mons.append(
|
||||
{'host': mon['name'], 'rank': mon['rank'], 'status': status})
|
||||
return [Monitor(m) for m in mons]
|
||||
|
||||
|
||||
def osd_list():
|
||||
# would use osd_find, but it doesn't give osd's name
|
||||
response, tree = cephwrapper().osd_tree(body='json')
|
||||
if not response.ok:
|
||||
response.raise_for_status()
|
||||
|
||||
osds = []
|
||||
for node in tree['output']['nodes']:
|
||||
# found osd
|
||||
if node['type'] == 'osd':
|
||||
osd = {}
|
||||
osd['id'] = node['id']
|
||||
osd['name'] = node['name']
|
||||
osd['status'] = node['status']
|
||||
|
||||
# check if osd belongs to host
|
||||
response, body = cephwrapper().osd_find(body='json', id=osd['id'])
|
||||
if response.ok and 'host' in body['output']['crush_location']:
|
||||
osd['host'] = body['output']['crush_location']['host']
|
||||
# else dont set hostname
|
||||
|
||||
osds.append(osd)
|
||||
|
||||
return [OSD(o) for o in osds]
|
|
@ -1,31 +0,0 @@
|
|||
# Copyright 2014, Rackspace, US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""This package holds the REST API that supports the Horizon dashboard
|
||||
Javascript code.
|
||||
|
||||
It is not intended to be used outside of Horizon, and makes no promises of
|
||||
stability or fitness for purpose outside of that scope.
|
||||
|
||||
It does not promise to adhere to the general OpenStack API Guidelines set out
|
||||
in https://wiki.openstack.org/wiki/APIChangeGuidelines.
|
||||
"""
|
||||
|
||||
from openstack_dashboard.api.rest import dc_manager
|
||||
from openstack_dashboard.api.rest import sysinv
|
||||
|
||||
|
||||
__all__ = [
|
||||
'dc_manager',
|
||||
'sysinv',
|
||||
]
|
|
@ -1,27 +0,0 @@
|
|||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block form_id %}add_physicalvolume_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:admin:inventory:addphysicalvolume' host_id %}{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Create Physical Volume" %}{% endblock %}
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description" %}:</h3>
|
||||
<p>{% trans "From here you can define the configuration of a new physical volume." %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<a class="btn btn-default cancel" data-dismiss="modal">Cancel</a>
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Physical Volume" %}" />
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
12
setup.cfg
12
setup.cfg
|
@ -1,11 +1,9 @@
|
|||
[metadata]
|
||||
name = cgcs-dashboard
|
||||
summary = CGCS Dashboard
|
||||
description-file =
|
||||
README.rst
|
||||
name = starlingx-dashboard
|
||||
summary = StarlingX Dashboard Panels
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
home-page = http://docs.openstack.org/developer/horizon/
|
||||
author_email = openstack-dev@lists.openstack.org
|
||||
home-page = https://wiki.openstack.org/wiki/StarlingX
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Framework :: Django
|
||||
|
@ -21,7 +19,7 @@ classifier =
|
|||
|
||||
[files]
|
||||
packages =
|
||||
wrs_dashboard
|
||||
starlingx_dashboard
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
|
|
4
setup.py
4
setup.py
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
# Copyright (c) 2018 Intel Corporation.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -26,4 +26,4 @@ except ImportError:
|
|||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr>=1.8'],
|
||||
pbr=True)
|
||||
pbr=True)
|
|
@ -10,22 +10,28 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2017 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
from cgcs_dashboard.api import ceilometer
|
||||
from cgcs_dashboard.api import ceph
|
||||
from cgcs_dashboard.api import dc_manager
|
||||
from cgcs_dashboard.api import iservice
|
||||
from cgcs_dashboard.api import patch
|
||||
from cgcs_dashboard.api import sysinv
|
||||
from cgcs_dashboard.api import vim
|
||||
|
||||
#from cgcs_dashboard.api import dc_manager
|
||||
#from cgcs_dashboard.api import iservice
|
||||
#from cgcs_dashboard.api import sysinv
|
||||
from starlingx_dashboard.api import vim
|
||||
from starlingx_dashboard.api import sysinv
|
||||
from starlingx_dashboard.api import patch
|
||||
|
||||
# TODO (ediardo): cleanup the imports below
|
||||
__all__ = [
|
||||
"ceilometer",
|
||||
"ceph",
|
||||
"dc_manager",
|
||||
"iservice",
|
||||
"patch",
|
||||
"nova",
|
||||
"sysinv",
|
||||
"vim",
|
||||
"patch"
|
||||
# "ceilometer",
|
||||
# "ceph",
|
||||
# "dc_manager",
|
||||
# "iservice",
|
||||
# "patch",
|
||||
# "sysinv",
|
||||
# "vim",
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from django.conf import settings
|
||||
from horizon import exceptions
|
||||
import six
|
||||
|
||||
def get_request_page_size(request, limit=None):
|
||||
default_limit = getattr(settings, 'API_RESULT_LIMIT', 1000)
|
||||
try:
|
||||
return min(int(limit), default_limit)
|
||||
except Exception:
|
||||
default_page_size = getattr(settings, 'API_RESULT_PAGE_SIZE', 20)
|
||||
return request.session.get('horizon_pagesize', default_page_size)
|
|
@ -1,73 +1,79 @@
|
|||
#
|
||||
# Copyright (c) 2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from dcmanagerclient.api.v1 import client
|
||||
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@memoized
|
||||
def dcmanagerclient(request):
|
||||
endpoint = base.url_for(request, 'dcmanager', 'adminURL')
|
||||
c = client.Client(project_id=request.user.project_id,
|
||||
user_id=request.user.id,
|
||||
auth_token=request.user.token.id,
|
||||
dcmanager_url=endpoint)
|
||||
return c
|
||||
|
||||
|
||||
class Summary(base.APIResourceWrapper):
|
||||
_attrs = ['name', 'critical', 'major', 'minor', 'warnings', 'status']
|
||||
|
||||
|
||||
def alarm_summary_list(request):
|
||||
summaries = dcmanagerclient(request).alarm_manager.list_alarms()
|
||||
return [Summary(summary) for summary in summaries]
|
||||
|
||||
|
||||
class Subcloud(base.APIResourceWrapper):
|
||||
_attrs = ['subcloud_id', 'name', 'description', 'location',
|
||||
'software_version', 'management_subnet', 'management_state',
|
||||
'availability_status', 'management_start_ip',
|
||||
'management_end_ip', 'management_gateway_ip',
|
||||
'systemcontroller_gateway_ip', 'created_at', 'updated_at',
|
||||
'sync_status', 'endpoint_sync_status', ]
|
||||
|
||||
|
||||
def subcloud_list(request):
|
||||
subclouds = dcmanagerclient(request).subcloud_manager.list_subclouds()
|
||||
return [Subcloud(subcloud) for subcloud in subclouds]
|
||||
|
||||
|
||||
def subcloud_create(request, data):
|
||||
return dcmanagerclient(request).subcloud_manager.add_subcloud(
|
||||
**data.get('data'))
|
||||
|
||||
|
||||
def subcloud_update(request, subcloud_id, changes):
|
||||
response = dcmanagerclient(request).subcloud_manager.update_subcloud(
|
||||
subcloud_id, **changes.get('updated'))
|
||||
# Updating returns a list of subclouds for some reason
|
||||
return [Subcloud(subcloud) for subcloud in response]
|
||||
|
||||
|
||||
def subcloud_delete(request, subcloud_id):
|
||||
return dcmanagerclient(request).subcloud_manager.delete_subcloud(
|
||||
subcloud_id)
|
||||
|
||||
|
||||
def subcloud_generate_config(request, subcloud_id, data):
|
||||
return dcmanagerclient(request).subcloud_manager.generate_config_subcloud(
|
||||
subcloud_id, **data)
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2017 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from dcmanagerclient.api.v1 import client
|
||||
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@memoized
|
||||
def dcmanagerclient(request):
|
||||
endpoint = base.url_for(request, 'dcmanager', 'adminURL')
|
||||
c = client.Client(project_id=request.user.project_id,
|
||||
user_id=request.user.id,
|
||||
auth_token=request.user.token.id,
|
||||
dcmanager_url=endpoint)
|
||||
return c
|
||||
|
||||
|
||||
class Summary(base.APIResourceWrapper):
|
||||
_attrs = ['name', 'critical', 'major', 'minor', 'warnings', 'status']
|
||||
|
||||
|
||||
def alarm_summary_list(request):
|
||||
summaries = dcmanagerclient(request).alarm_manager.list_alarms()
|
||||
return [Summary(summary) for summary in summaries]
|
||||
|
||||
|
||||
class Subcloud(base.APIResourceWrapper):
|
||||
_attrs = ['subcloud_id', 'name', 'description', 'location',
|
||||
'software_version', 'management_subnet', 'management_state',
|
||||
'availability_status', 'management_start_ip',
|
||||
'management_end_ip', 'management_gateway_ip',
|
||||
'systemcontroller_gateway_ip', 'created_at', 'updated_at',
|
||||
'sync_status', 'endpoint_sync_status', ]
|
||||
|
||||
|
||||
def subcloud_list(request):
|
||||
subclouds = dcmanagerclient(request).subcloud_manager.list_subclouds()
|
||||
return [Subcloud(subcloud) for subcloud in subclouds]
|
||||
|
||||
|
||||
def subcloud_create(request, data):
|
||||
return dcmanagerclient(request).subcloud_manager.add_subcloud(
|
||||
**data.get('data'))
|
||||
|
||||
|
||||
def subcloud_update(request, subcloud_id, changes):
|
||||
response = dcmanagerclient(request).subcloud_manager.update_subcloud(
|
||||
subcloud_id, **changes.get('updated'))
|
||||
# Updating returns a list of subclouds for some reason
|
||||
return [Subcloud(subcloud) for subcloud in response]
|
||||
|
||||
|
||||
def subcloud_delete(request, subcloud_id):
|
||||
return dcmanagerclient(request).subcloud_manager.delete_subcloud(
|
||||
subcloud_id)
|
||||
|
||||
|
||||
def subcloud_generate_config(request, subcloud_id, data):
|
||||
return dcmanagerclient(request).subcloud_manager.generate_config_subcloud(
|
||||
subcloud_id, **data)
|
|
@ -12,12 +12,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# Copyright (c) 2018 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from openstack_dashboard.api.nova import *
|
||||
|
||||
def server_group_create(request, **kwargs):
|
||||
return novaclient(request).server_groups.create(**kwargs)
|
|
@ -12,10 +12,6 @@
|
|||
#
|
||||
# Copyright (c) 2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
import logging
|
||||
import urlparse
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright 2014, Rackspace, US, Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2014 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
from openstack_dashboard.api.rest import dc_manager
|
||||
from openstack_dashboard.api.rest import sysinv
|
||||
|
||||
|
||||
__all__ = [
|
||||
'dc_manager',
|
||||
'sysinv',
|
||||
]
|
|
@ -1,10 +1,17 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
|
@ -1,10 +1,18 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
|
||||
from django.views import generic
|
||||
|
|
@ -10,14 +10,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
# Copyright (c) 2013-2018 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
@ -31,6 +25,7 @@ from django.conf import settings
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from openstack_dashboard.api import base
|
||||
from starlingx_dashboard.api import base as stx_base
|
||||
|
||||
import cgcs_patch.constants as patch_constants
|
||||
import sysinv.common.constants as constants
|
||||
|
@ -142,7 +137,7 @@ def cgtsclient(request):
|
|||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||
|
||||
# FIXME this returns the wrong URL
|
||||
endpoint = base.url_for(request, 'platform', 'adminURL')
|
||||
endpoint = base.url_for(request, 'platform', 'publicURL')
|
||||
version = 1
|
||||
|
||||
LOG.debug('cgtsclient connection created using token "%s" and url "%s"',
|
||||
|
@ -153,7 +148,7 @@ def cgtsclient(request):
|
|||
return cgts_client.Client(version=version,
|
||||
endpoint=endpoint,
|
||||
auth_url=base.url_for(request, 'identity',
|
||||
'adminURL'),
|
||||
'publicURL'),
|
||||
token=request.user.token.id, # os_auth_token
|
||||
username=request.user.username,
|
||||
password=request.user.token.id,
|
||||
|
@ -169,9 +164,6 @@ class Memory(base.APIResourceWrapper):
|
|||
'platform_reserved_mib',
|
||||
'memavail_mib',
|
||||
'hugepages_configured',
|
||||
'avs_hugepages_size_mib',
|
||||
'avs_hugepages_nr',
|
||||
'avs_hugepages_avail',
|
||||
'vm_hugepages_nr_2M_pending',
|
||||
'vm_hugepages_avail_2M',
|
||||
'vm_hugepages_nr_1G_pending',
|
||||
|
@ -288,6 +280,7 @@ class StorageVolume(base.APIResourceWrapper):
|
|||
'capabilities',
|
||||
'idisk_uuid',
|
||||
'ihost_uuid',
|
||||
'tier_name',
|
||||
'journal_path',
|
||||
'journal_size_mib',
|
||||
'journal_location']
|
||||
|
@ -1066,7 +1059,7 @@ def alarm_list(request, search_opts=None):
|
|||
marker = search_opts.get('marker', None)
|
||||
sort_key = search_opts.get('sort_key', None)
|
||||
sort_dir = search_opts.get('sort_dir', None)
|
||||
page_size = base.get_request_page_size(request, limit)
|
||||
page_size = stx_base.get_request_page_size(request, limit)
|
||||
|
||||
if "suppression" in search_opts:
|
||||
suppression = search_opts.pop('suppression')
|
||||
|
@ -1400,17 +1393,94 @@ def extoam_list(request):
|
|||
return [EXTOAM(n) for n in extoam]
|
||||
|
||||
|
||||
class Cluster(base.APIResourceWrapper):
|
||||
"""..."""
|
||||
_attrs = ['uuid', 'cluster_uuid', 'type', 'name']
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Cluster, self).__init__(apiresource)
|
||||
|
||||
if hasattr(self, 'uuid'):
|
||||
self._uuid = self.uuid
|
||||
self._name = self.name
|
||||
self._type = self.type
|
||||
self._cluster_uuid = self.cluster_uuid
|
||||
else:
|
||||
self._uuid = None
|
||||
self._name = None
|
||||
self._type = None
|
||||
self._cluster_uuid = None
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
return self._uuid
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def cluster_uuid(self):
|
||||
return self._cluster_uuid
|
||||
|
||||
|
||||
def cluster_list(request):
|
||||
clusters = cgtsclient(request).cluster.list()
|
||||
|
||||
return [Cluster(n) for n in clusters]
|
||||
|
||||
|
||||
class StorageTier(base.APIResourceWrapper):
|
||||
"""..."""
|
||||
_attrs = ['uuid', 'name', 'type', 'status']
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(StorageTier, self).__init__(apiresource)
|
||||
|
||||
if hasattr(self, 'uuid'):
|
||||
self._uuid = self.uuid
|
||||
self._name = self.name
|
||||
self._type = self.type
|
||||
self._status = self.status
|
||||
else:
|
||||
self._uuid = None
|
||||
self._name = None
|
||||
self._type = None
|
||||
self._status = None
|
||||
|
||||
@property
|
||||
def uuid(self):
|
||||
return self._uuid
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return self._type
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
return self._status
|
||||
|
||||
|
||||
class StorageCeph(base.APIResourceWrapper):
|
||||
"""..."""
|
||||
|
||||
_attrs = ['cinder_pool_gib', 'glance_pool_gib', 'ephemeral_pool_gib',
|
||||
'object_pool_gib', 'object_gateway', 'uuid', 'link',
|
||||
'object_pool_gib', 'object_gateway', 'uuid', 'tier_name', 'link',
|
||||
'ceph_total_space_gib']
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(StorageCeph, self).__init__(apiresource)
|
||||
|
||||
if hasattr(self, 'uuid'):
|
||||
self._tier_name = self.tier_name
|
||||
self._cinder_pool_gib = self.cinder_pool_gib
|
||||
self._glance_pool_gib = self.glance_pool_gib
|
||||
self._ephemeral_pool_gib = self.ephemeral_pool_gib
|
||||
|
@ -1418,6 +1488,7 @@ class StorageCeph(base.APIResourceWrapper):
|
|||
self._object_gateway = self.object_gateway
|
||||
self._ceph_total_space_gib = self.ceph_total_space_gib
|
||||
else:
|
||||
self._tier_name = None
|
||||
self._cinder_pool_gib = None
|
||||
self._glance_pool_gib = None
|
||||
self._ephemeral_pool_gib = None
|
||||
|
@ -1425,6 +1496,10 @@ class StorageCeph(base.APIResourceWrapper):
|
|||
self._object_gateway = None
|
||||
self._ceph_total_space_gib = None
|
||||
|
||||
@property
|
||||
def tier_name(self):
|
||||
return self._tier_name
|
||||
|
||||
@property
|
||||
def cinder_pool_gib(self):
|
||||
return self._cinder_pool_gib
|
||||
|
@ -1452,12 +1527,14 @@ class StorageCeph(base.APIResourceWrapper):
|
|||
|
||||
class StorageBackend(base.APIResourceWrapper):
|
||||
"""..."""
|
||||
_attrs = ['isystem_uuid', 'backend', 'state', 'task', 'uuid', 'link']
|
||||
_attrs = ['isystem_uuid', 'name', 'backend',
|
||||
'state', 'task', 'uuid', 'link']
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(StorageBackend, self).__init__(apiresource)
|
||||
|
||||
if hasattr(self, 'uuid'):
|
||||
self._name = self.name
|
||||
self._backend = self.backend
|
||||
self._state = self.state
|
||||
self._task = self.task
|
||||
|
@ -1466,6 +1543,10 @@ class StorageBackend(base.APIResourceWrapper):
|
|||
self._state = None
|
||||
self._task = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def backend(self):
|
||||
return self._backend
|
||||
|
@ -1554,37 +1635,20 @@ class CephMon(base.APIResourceWrapper):
|
|||
class STORAGE(base.APIResourceWrapper):
|
||||
"""..."""
|
||||
_attrs = ['isystem_uuid', 'backup_gib', 'scratch_gib', 'cgcs_gib',
|
||||
'img_conversions_gib', 'database_gib',
|
||||
'uuid', 'link', 'backend', 'glance_backend',
|
||||
'cinder_pool_gib', 'glance_pool_gib', 'ephemeral_pool_gib',
|
||||
'object_pool_gib', 'ceph_mon_gib', 'ceph_total_space_gib']
|
||||
'img_conversions_gib', 'database_gib', 'uuid', 'link']
|
||||
|
||||
def __init__(self, controller_fs, ceph_mon, storage_ceph):
|
||||
def __init__(self, controller_fs, ceph_mon):
|
||||
if controller_fs:
|
||||
super(STORAGE, self).__init__(controller_fs)
|
||||
elif storage_ceph:
|
||||
super(STORAGE, self).__init__(storage_ceph)
|
||||
|
||||
self._backup_gib = None
|
||||
self._scratch_gib = None
|
||||
self._cgcs_gib = None
|
||||
self._img_conversions_gib = None
|
||||
self._database_gib = None
|
||||
self._backend = None
|
||||
self._cinder_pool_gib = None
|
||||
self._glance_pool_gib = None
|
||||
self._ephemeral_pool_gib = None
|
||||
self._ceph_mon_gib = None
|
||||
self._ceph_total_space_gib = None
|
||||
|
||||
if hasattr(self, 'uuid'):
|
||||
if storage_ceph:
|
||||
self._glance_pool_gib = storage_ceph.glance_pool_gib
|
||||
self._ephemeral_pool_gib = storage_ceph.ephemeral_pool_gib
|
||||
self._cinder_pool_gib = storage_ceph.cinder_pool_gib
|
||||
self._object_pool_gib = storage_ceph.object_pool_gib
|
||||
self._ceph_total_space_gib = storage_ceph.ceph_total_space_gib
|
||||
|
||||
if controller_fs:
|
||||
self._backup_gib = controller_fs.backup_gib
|
||||
self._scratch_gib = controller_fs.scratch_gib
|
||||
|
@ -1617,34 +1681,10 @@ class STORAGE(base.APIResourceWrapper):
|
|||
def img_conversions_gib(self):
|
||||
return self._img_conversions_gib
|
||||
|
||||
@property
|
||||
def backend(self):
|
||||
return self._backend
|
||||
|
||||
@property
|
||||
def glance_backend(self):
|
||||
return self._glance_backend
|
||||
|
||||
@property
|
||||
def cinder_pool_gib(self):
|
||||
return self._cinder_pool_gib
|
||||
|
||||
@property
|
||||
def glance_pool_gib(self):
|
||||
return self._glance_pool_gib
|
||||
|
||||
@property
|
||||
def ephemeral_pool_gib(self):
|
||||
return self._ephemeral_pool_gib
|
||||
|
||||
@property
|
||||
def ceph_mon_gib(self):
|
||||
return self._ceph_mon_gib
|
||||
|
||||
@property
|
||||
def ceph_total_space_gib(self):
|
||||
return self._ceph_total_space_gib
|
||||
|
||||
|
||||
def storfs_update(request, controller_fs_id, **kwargs):
|
||||
LOG.info("Updating controller fs storage with kwargs=%s", kwargs)
|
||||
|
@ -1752,7 +1792,7 @@ def storagefs_list(request):
|
|||
if ceph_mon_list:
|
||||
ceph_mon_obj = ceph_mon_list[0]
|
||||
|
||||
return [STORAGE(controllerfs_obj, ceph_mon_obj, None)]
|
||||
return [STORAGE(controllerfs_obj, ceph_mon_obj)]
|
||||
|
||||
|
||||
def controllerfs_list(request):
|
||||
|
@ -1765,6 +1805,12 @@ def controllerfs_list(request):
|
|||
return [ControllerFS(n) for n in controllerfs]
|
||||
|
||||
|
||||
def storage_tier_list(request, cluster_id):
|
||||
storage_tiers = cgtsclient(request).storage_tier.list(cluster_id)
|
||||
|
||||
return [StorageTier(n) for n in storage_tiers]
|
||||
|
||||
|
||||
def storage_backend_list(request):
|
||||
backends = cgtsclient(request).storage_backend.list()
|
||||
|
||||
|
@ -1982,8 +2028,7 @@ def host_interface_delete(request, interface_id):
|
|||
class Address(base.APIResourceWrapper):
|
||||
"""Wrapper for Inventory Addresses"""
|
||||
|
||||
_attrs = ['uuid', 'interface_uuid', 'networktype', 'address', 'prefix',
|
||||
'enable_dad']
|
||||
_attrs = ['uuid', 'interface_uuid', 'address', 'prefix', 'enable_dad']
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Address, self).__init__(apiresource)
|
||||
|
@ -2317,7 +2362,7 @@ def event_log_list(request, search_opts=None):
|
|||
|
||||
limit = search_opts.get('limit', None)
|
||||
marker = search_opts.get('marker', None)
|
||||
page_size = base.get_request_page_size(request, limit)
|
||||
page_size = stx_base.get_request_page_size(request, limit)
|
||||
|
||||
if 'paginate' in search_opts:
|
||||
paginate = search_opts.pop('paginate')
|
|
@ -1,10 +1,17 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
import logging
|
||||
import urlparse
|
|
@ -18,9 +18,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
||||
|
@ -35,12 +32,16 @@ class FaultManagement(horizon.Panel):
|
|||
permissions = ('openstack.services.platform',)
|
||||
|
||||
def allowed(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
||||
return super(FaultManagement, self).allowed(context)
|
||||
|
||||
def nav(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
|
@ -18,9 +18,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
|
||||
|
||||
from django.utils.html import escape as escape_html
|
||||
|
@ -32,9 +29,10 @@ from django.utils.translation import ungettext_lazy
|
|||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from starlingx_dashboard.horizon import tables as stx_tables
|
||||
from horizon.utils import filters as utils_filters
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.api import sysinv
|
||||
from starlingx_dashboard import api as stx_api
|
||||
|
||||
SUPPRESSION_STATUS_CHOICES = (
|
||||
("suppressed", False),
|
||||
|
@ -50,21 +48,21 @@ SUPPRESSION_STATUS_DISPLAY_CHOICES = (
|
|||
)
|
||||
|
||||
|
||||
class AlarmsLimitAction(tables.LimitAction):
|
||||
class AlarmsLimitAction(stx_tables.LimitAction):
|
||||
verbose_name = _("Alarms")
|
||||
|
||||
|
||||
class AlarmFilterAction(tables.FixedWithQueryFilter):
|
||||
class AlarmFilterAction(stx_tables.FixedWithQueryFilter):
|
||||
def __init__(self, **kwargs):
|
||||
super(AlarmFilterAction, self).__init__(**kwargs)
|
||||
|
||||
self.filter_choices = [
|
||||
(
|
||||
(sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True),
|
||||
(sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True)
|
||||
(stx_api.sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True),
|
||||
(stx_api.sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True)
|
||||
)
|
||||
]
|
||||
self.default_value = sysinv.FM_SUPPRESS_HIDE
|
||||
self.default_value = stx_api.sysinv.FM_SUPPRESS_HIDE
|
||||
|
||||
self.disabled_choices = ['enabled']
|
||||
|
||||
|
@ -105,26 +103,26 @@ class AlarmsTable(tables.DataTable):
|
|||
hidden_title = False
|
||||
|
||||
|
||||
class EventLogsLimitAction(tables.LimitAction):
|
||||
class EventLogsLimitAction(stx_tables.LimitAction):
|
||||
verbose_name = _("Events")
|
||||
|
||||
|
||||
class EventLogsFilterAction(tables.FixedWithQueryFilter):
|
||||
class EventLogsFilterAction(stx_tables.FixedWithQueryFilter):
|
||||
def __init__(self, **kwargs):
|
||||
super(EventLogsFilterAction, self).__init__(**kwargs)
|
||||
|
||||
self.filter_choices = [
|
||||
(
|
||||
(sysinv.FM_ALL, _("All Events"), True),
|
||||
(sysinv.FM_ALARM, _('Alarm Events'), True),
|
||||
(sysinv.FM_LOG, _('Log Events'), True),
|
||||
(stx_api.sysinv.FM_ALL, _("All Events"), True),
|
||||
(stx_api.sysinv.FM_ALARM, _('Alarm Events'), True),
|
||||
(stx_api.sysinv.FM_LOG, _('Log Events'), True),
|
||||
),
|
||||
(
|
||||
(sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True),
|
||||
(sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True)
|
||||
(stx_api.sysinv.FM_SUPPRESS_SHOW, _("Show Suppressed"), True),
|
||||
(stx_api.sysinv.FM_SUPPRESS_HIDE, _('Hide Suppressed'), True)
|
||||
)
|
||||
]
|
||||
self.default_value = sysinv.FM_ALL_SUPPRESS_HIDE
|
||||
self.default_value = stx_api.sysinv.FM_ALL_SUPPRESS_HIDE
|
||||
|
||||
self.disabled_choices = ['enabled', 'enabled']
|
||||
|
||||
|
@ -190,16 +188,16 @@ class SuppressEvent(tables.BatchAction):
|
|||
|
||||
def allowed(self, request, datum):
|
||||
"""Allow suppress action if Alarm ID is unsuppressed."""
|
||||
if datum.suppression_status == sysinv.FM_SUPPRESSED:
|
||||
if datum.suppression_status == stx_api.sysinv.FM_SUPPRESSED:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def action(self, request, obj_id):
|
||||
kwargs = {"suppression_status": sysinv.FM_SUPPRESSED}
|
||||
kwargs = {"suppression_status": stx_api.sysinv.FM_SUPPRESSED}
|
||||
|
||||
try:
|
||||
api.sysinv.event_suppression_update(request, obj_id, **kwargs)
|
||||
stx_api.sysinv.event_suppression_update(request, obj_id, **kwargs)
|
||||
except Exception:
|
||||
exceptions.handle(request,
|
||||
_('Unable to set specified alarm type to \
|
||||
|
@ -230,16 +228,16 @@ class UnsuppressEvent(tables.BatchAction):
|
|||
|
||||
def allowed(self, request, datum):
|
||||
"""Allow unsuppress action if Alarm ID is suppressed."""
|
||||
if datum.suppression_status == sysinv.FM_UNSUPPRESSED:
|
||||
if datum.suppression_status == stx_api.sysinv.FM_UNSUPPRESSED:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def action(self, request, obj_id):
|
||||
kwargs = {"suppression_status": sysinv.FM_UNSUPPRESSED}
|
||||
kwargs = {"suppression_status": stx_api.sysinv.FM_UNSUPPRESSED}
|
||||
|
||||
try:
|
||||
api.sysinv.event_suppression_update(request, obj_id, **kwargs)
|
||||
stx_api.sysinv.event_suppression_update(request, obj_id, **kwargs)
|
||||
except Exception:
|
||||
exceptions.handle(request,
|
||||
_('Unable to set specified alarm type to \
|
|
@ -18,9 +18,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
||||
|
@ -28,8 +25,8 @@ from django.utils.translation import ugettext_lazy as _ # noqa
|
|||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.api import sysinv
|
||||
from openstack_dashboard.dashboards.admin.fault_management import tables
|
||||
from starlingx_dashboard import api as stx_api
|
||||
from starlingx_dashboard.dashboards.admin.fault_management import tables
|
||||
|
||||
ALARMS_SUPPRESSION_FILTER_GROUP = 0
|
||||
EVENT_SUPPRESSION_FILTER_GROUP = 1
|
||||
|
@ -61,7 +58,7 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
def get_context_data(self, request):
|
||||
context = super(ActiveAlarmsTab, self).get_context_data(request)
|
||||
|
||||
summary = api.sysinv.alarm_summary_get(
|
||||
summary = stx_api.sysinv.alarm_summary_get(
|
||||
self.request, include_suppress=False)
|
||||
context["total"] = summary.critical + summary.major + summary.minor \
|
||||
+ summary.warnings
|
||||
|
@ -86,7 +83,7 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
self.set_suppression_filter('disabled')
|
||||
alarms_table.columns["suppression_status"]\
|
||||
.classes.append('hidden')
|
||||
elif suppress_filter_state == sysinv.FM_SUPPRESS_HIDE:
|
||||
elif suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_HIDE:
|
||||
self.set_suppression_filter('enabled')
|
||||
alarms_table.columns["suppression_status"].classes\
|
||||
.append('hidden')
|
||||
|
@ -95,7 +92,7 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
self.set_suppression_filter('disabled')
|
||||
else:
|
||||
self.set_suppression_filter('enabled')
|
||||
if suppress_filter_state == sysinv.FM_SUPPRESS_SHOW:
|
||||
if suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_SHOW:
|
||||
alarms_table.columns["suppression_status"].classes\
|
||||
.remove('hidden')
|
||||
|
||||
|
@ -117,18 +114,16 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
|
||||
def get_alarms_data(self):
|
||||
search_opts = {}
|
||||
|
||||
# get retrieve parameters from request/session env
|
||||
marker = \
|
||||
self.request.GET.get(tables.AlarmsTable._meta.pagination_param,
|
||||
None)
|
||||
limit = \
|
||||
self.request.GET.get(tables.AlarmsTable._meta.limit_param,
|
||||
None)
|
||||
#marker = \
|
||||
# self.request.GET.get(tables.AlarmsTable._meta.pagination_param,
|
||||
# None)
|
||||
#limit = \
|
||||
# self.request.GET.get(tables.AlarmsTable._meta.limit_param,
|
||||
# None)
|
||||
|
||||
search_opts = self.get_filters()
|
||||
search_opts.update({'marker': marker,
|
||||
'limit': limit,
|
||||
search_opts.update({
|
||||
'paginate': True,
|
||||
'sort_key': 'severity,entity_instance_id',
|
||||
'sort_dir': 'asc'})
|
||||
|
@ -136,10 +131,10 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
alarms = []
|
||||
try:
|
||||
if 'paginate' in search_opts:
|
||||
alarms, self._more = api.sysinv.alarm_list(
|
||||
alarms, self._more = stx_api.sysinv.alarm_list(
|
||||
self.request, search_opts=search_opts)
|
||||
else:
|
||||
alarms = api.sysinv.alarm_list(
|
||||
alarms = stx_api.sysinv.alarm_list(
|
||||
self.request, search_opts=search_opts)
|
||||
self._limit = limit
|
||||
except Exception:
|
||||
|
@ -155,7 +150,7 @@ class ActiveAlarmsTab(tabs.TableTab):
|
|||
try:
|
||||
if 'suppression_list' not in self.tab_group.kwargs:
|
||||
self.tab_group.kwargs['suppression_list'] = \
|
||||
api.sysinv.event_suppression_list(self.request)
|
||||
stx_api.sysinv.event_suppression_list(self.request)
|
||||
event_types = self.tab_group.kwargs['suppression_list']
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
||||
|
@ -212,7 +207,7 @@ class EventLogTab(tabs.TableTab):
|
|||
self.set_suppression_filter('disabled')
|
||||
event_log_table.columns["suppression_status"]\
|
||||
.classes.append('hidden')
|
||||
elif suppress_filter_state == sysinv.FM_SUPPRESS_HIDE:
|
||||
elif suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_HIDE:
|
||||
self.set_suppression_filter('enabled')
|
||||
event_log_table.columns["suppression_status"].\
|
||||
classes.append('hidden')
|
||||
|
@ -221,7 +216,7 @@ class EventLogTab(tabs.TableTab):
|
|||
self.set_suppression_filter('disabled')
|
||||
else:
|
||||
self.set_suppression_filter('enabled')
|
||||
if suppress_filter_state == sysinv.FM_SUPPRESS_SHOW:
|
||||
if suppress_filter_state == stx_api.sysinv.FM_SUPPRESS_SHOW:
|
||||
event_log_table.columns["suppression_status"]\
|
||||
.classes.remove('hidden')
|
||||
|
||||
|
@ -258,7 +253,7 @@ class EventLogTab(tabs.TableTab):
|
|||
try:
|
||||
# now retrieve data from rest API
|
||||
events, self._more = \
|
||||
api.sysinv.event_log_list(self.request,
|
||||
stx_api.sysinv.event_log_list(self.request,
|
||||
search_opts=search_opts)
|
||||
self._limit = limit
|
||||
return events
|
||||
|
@ -278,7 +273,7 @@ class EventLogTab(tabs.TableTab):
|
|||
try:
|
||||
if 'suppression_list' not in self.tab_group.kwargs:
|
||||
self.tab_group.kwargs['suppression_list'] = \
|
||||
api.sysinv.event_suppression_list(self.request)
|
||||
stx_api.sysinv.event_suppression_list(self.request)
|
||||
event_types = self.tab_group.kwargs['suppression_list']
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
||||
|
@ -300,7 +295,7 @@ class EventsSuppressionTab(tabs.TableTab):
|
|||
try:
|
||||
if 'suppression_list' not in self.tab_group.kwargs:
|
||||
self.tab_group.kwargs['suppression_list'] = \
|
||||
api.sysinv.event_suppression_list(self.request)
|
||||
stx_api.sysinv.event_suppression_list(self.request)
|
||||
event_suppression_list = self.tab_group.kwargs['suppression_list']
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
|
@ -1,58 +1,58 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n breadcrumb_nav %}
|
||||
{% block title %}{% trans "Historical Alarm Details" %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% if history.event_log_id == '' or history.event_log_id == ' ' %}
|
||||
<h3> {{history.reason_text }} </h3>
|
||||
{% else %}
|
||||
<h3> {{history.state }} - {{history.event_log_id }} - {{history.reason_text }} </h3>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="info row-fluid detail">
|
||||
<h4>{% trans "Info" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "Alarm UUID" %}</dt>
|
||||
<dd>{{ history.uuid }}</dd>
|
||||
{% if history.event_log_id != '' and history.event_log_id != ' ' %}
|
||||
<dt>{% trans "Alarm ID" %}</dt>
|
||||
<dd>{{ history.event_log_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Severity" %}</dt>
|
||||
<dd>{{ history.severity }}</dd>
|
||||
<dt>{% trans "Alarm State" %}</dt>
|
||||
<dd>{{ history.state }}</dd>
|
||||
<dt>{% trans "Alarm Type" %}</dt>
|
||||
<dd>{{ history.event_log_type }}</dd>
|
||||
<dt>{% trans "Timestamp" %}</dt>
|
||||
<dd>{{ history.timestamp|parse_isotime }}</dd>
|
||||
<dt>{% trans "Suppression" %}</dt>
|
||||
<dd>{{ history.suppression }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{% trans "Entity Instance ID" %}</dt>
|
||||
<dd>{{ history.entity_instance_id }}</dd>
|
||||
{% if history.entity_type_id != '' and history.entity_type_id != ' ' %}
|
||||
<dt>{% trans "Entity Type ID" %}</dt>
|
||||
<dd>{{ history.entity_type_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Probable Cause" %}</dt>
|
||||
<dd>{{ history.probable_cause }}</dd>
|
||||
{% if history.proposed_repair_action != '' and history.proposed_repair_action != ' ' %}
|
||||
<dt>{% trans "Proposed Repair Action" %}</dt>
|
||||
<dd>{{ history.proposed_repair_action }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Service Affecting" %}</dt>
|
||||
<dd>{{ history.service_affecting }}</dd>
|
||||
{% if history.reason_text != '' and history.reason_text != ' ' %}
|
||||
<dt>{% trans "Reason" %}</dt>
|
||||
<dd>{{ history.reason_text }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n breadcrumb_nav %}
|
||||
{% block title %}{% trans "Historical Alarm Details" %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% if history.event_log_id == '' or history.event_log_id == ' ' %}
|
||||
<h3> {{history.reason_text }} </h3>
|
||||
{% else %}
|
||||
<h3> {{history.state }} - {{history.event_log_id }} - {{history.reason_text }} </h3>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="info row-fluid detail">
|
||||
<h4>{% trans "Info" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "Alarm UUID" %}</dt>
|
||||
<dd>{{ history.uuid }}</dd>
|
||||
{% if history.event_log_id != '' and history.event_log_id != ' ' %}
|
||||
<dt>{% trans "Alarm ID" %}</dt>
|
||||
<dd>{{ history.event_log_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Severity" %}</dt>
|
||||
<dd>{{ history.severity }}</dd>
|
||||
<dt>{% trans "Alarm State" %}</dt>
|
||||
<dd>{{ history.state }}</dd>
|
||||
<dt>{% trans "Alarm Type" %}</dt>
|
||||
<dd>{{ history.event_log_type }}</dd>
|
||||
<dt>{% trans "Timestamp" %}</dt>
|
||||
<dd>{{ history.timestamp|parse_isotime }}</dd>
|
||||
<dt>{% trans "Suppression" %}</dt>
|
||||
<dd>{{ history.suppression }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{% trans "Entity Instance ID" %}</dt>
|
||||
<dd>{{ history.entity_instance_id }}</dd>
|
||||
{% if history.entity_type_id != '' and history.entity_type_id != ' ' %}
|
||||
<dt>{% trans "Entity Type ID" %}</dt>
|
||||
<dd>{{ history.entity_type_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Probable Cause" %}</dt>
|
||||
<dd>{{ history.probable_cause }}</dd>
|
||||
{% if history.proposed_repair_action != '' and history.proposed_repair_action != ' ' %}
|
||||
<dt>{% trans "Proposed Repair Action" %}</dt>
|
||||
<dd>{{ history.proposed_repair_action }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Service Affecting" %}</dt>
|
||||
<dd>{{ history.service_affecting }}</dd>
|
||||
{% if history.reason_text != '' and history.reason_text != ' ' %}
|
||||
<dt>{% trans "Reason" %}</dt>
|
||||
<dd>{{ history.reason_text }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,50 +1,50 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n breadcrumb_nav %}
|
||||
{% block title %}{% trans "Customer Log Details" %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% if log.event_log_id == '' or log.event_log_id == ' ' %}
|
||||
<h3> {{log.reason_text }} </h3>
|
||||
{% else %}
|
||||
<h3> {{log.event_log_id }} - {{log.reason_text }} </h3>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="info row-fluid detail">
|
||||
<h4>{% trans "Info" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "Log UUID" %}</dt>
|
||||
<dd>{{ log.uuid }}</dd>
|
||||
{% if log.event_log_id != '' and log.event_log_id != ' ' %}
|
||||
<dt>{% trans "Log ID" %}</dt>
|
||||
<dd>{{ log.event_log_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Severity" %}</dt>
|
||||
<dd>{{ log.severity }}</dd>
|
||||
<dt>{% trans "Log Type" %}</dt>
|
||||
<dd>{{ log.event_log_type }}</dd>
|
||||
<dt>{% trans "Timestamp" %}</dt>
|
||||
<dd>{{ log.timestamp|parse_isotime }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{% trans "Entity Instance ID" %}</dt>
|
||||
<dd>{{ log.entity_instance_id }}</dd>
|
||||
{% if log.entity_type_id != '' and log.entity_type_id != ' ' %}
|
||||
<dt>{% trans "Entity Type ID" %}</dt>
|
||||
<dd>{{ log.entity_type_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Probable Cause" %}</dt>
|
||||
<dd>{{ log.probable_cause }}</dd>
|
||||
<dt>{% trans "Service Affecting" %}</dt>
|
||||
<dd>{{ log.service_affecting }}</dd>
|
||||
{% if log.reason_text != '' and log.reason_text != ' ' %}
|
||||
<dt>{% trans "Reason" %}</dt>
|
||||
<dd>{{ log.reason_text }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n breadcrumb_nav %}
|
||||
{% block title %}{% trans "Customer Log Details" %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
{% if log.event_log_id == '' or log.event_log_id == ' ' %}
|
||||
<h3> {{log.reason_text }} </h3>
|
||||
{% else %}
|
||||
<h3> {{log.event_log_id }} - {{log.reason_text }} </h3>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="info row-fluid detail">
|
||||
<h4>{% trans "Info" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "Log UUID" %}</dt>
|
||||
<dd>{{ log.uuid }}</dd>
|
||||
{% if log.event_log_id != '' and log.event_log_id != ' ' %}
|
||||
<dt>{% trans "Log ID" %}</dt>
|
||||
<dd>{{ log.event_log_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Severity" %}</dt>
|
||||
<dd>{{ log.severity }}</dd>
|
||||
<dt>{% trans "Log Type" %}</dt>
|
||||
<dd>{{ log.event_log_type }}</dd>
|
||||
<dt>{% trans "Timestamp" %}</dt>
|
||||
<dd>{{ log.timestamp|parse_isotime }}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>{% trans "Entity Instance ID" %}</dt>
|
||||
<dd>{{ log.entity_instance_id }}</dd>
|
||||
{% if log.entity_type_id != '' and log.entity_type_id != ' ' %}
|
||||
<dt>{% trans "Entity Type ID" %}</dt>
|
||||
<dd>{{ log.entity_type_id }}</dd>
|
||||
{% endif %}
|
||||
<dt>{% trans "Probable Cause" %}</dt>
|
||||
<dd>{{ log.probable_cause }}</dd>
|
||||
<dt>{% trans "Service Affecting" %}</dt>
|
||||
<dd>{{ log.service_affecting }}</dd>
|
||||
{% if log.reason_text != '' and log.reason_text != ' ' %}
|
||||
<dt>{% trans "Reason" %}</dt>
|
||||
<dd>{{ log.reason_text }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -18,14 +18,11 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
|
||||
|
||||
from django.conf.urls import url # noqa
|
||||
|
||||
from openstack_dashboard.dashboards.admin.fault_management import views
|
||||
from starlingx_dashboard.dashboards.admin.fault_management import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
|
@ -18,9 +18,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
|
||||
|
||||
import logging
|
||||
|
@ -32,8 +29,9 @@ from django.views.generic import TemplateView
|
|||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
from horizon import views
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.dashboards.admin.fault_management import \
|
||||
from openstack_dashboard.api.base import is_service_enabled
|
||||
from starlingx_dashboard import api as stx_api
|
||||
from starlingx_dashboard.dashboards.admin.fault_management import \
|
||||
tabs as project_tabs
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -58,7 +56,7 @@ class DetailView(views.HorizonTemplateView):
|
|||
if not hasattr(self, "_alarm"):
|
||||
alarm_uuid = self.kwargs['id']
|
||||
try:
|
||||
alarm = api.sysinv.alarm_get(self.request, alarm_uuid)
|
||||
alarm = stx_api.sysinv.alarm_get(self.request, alarm_uuid)
|
||||
|
||||
except Exception:
|
||||
redirect = reverse('horizon:admin:fault_management:index')
|
||||
|
@ -120,7 +118,7 @@ class EventLogDetailView(views.HorizonTemplateView):
|
|||
if not hasattr(self, "_eventlog"):
|
||||
uuid = self.kwargs['id']
|
||||
try:
|
||||
self._eventlog = api.sysinv.event_log_get(self.request, uuid)
|
||||
self._eventlog = stx_api.sysinv.event_log_get(self.request, uuid)
|
||||
self._detectEventLogType()
|
||||
except Exception:
|
||||
redirect = reverse('horizon:admin:fault_management:index')
|
||||
|
@ -157,7 +155,7 @@ class BannerView(TemplateView):
|
|||
[s for s in summaries if s.status == 'critical'])
|
||||
context["disabled"] = len(
|
||||
[s for s in summaries if s.status == 'disabled'])
|
||||
elif api.base.is_TiS_region(self.request):
|
||||
elif is_service_enabled(self.request, 'platform'):
|
||||
context["summary"] = self.get_data()
|
||||
context["alarmbanner"] = True
|
||||
return context
|
||||
|
@ -165,11 +163,11 @@ class BannerView(TemplateView):
|
|||
def get_data(self):
|
||||
summary = None
|
||||
try:
|
||||
summary = api.sysinv.alarm_summary_get(self.request)
|
||||
summary = stx_api.sysinv.alarm_summary_get(self.request)
|
||||
except Exception:
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve alarm summary.'))
|
||||
return summary
|
||||
|
||||
def get_subcloud_data(self):
|
||||
return api.dc_manager.alarm_summary_list(self.request)
|
||||
return stx_api.dc_manager.alarm_summary_list(self.request)
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
|
||||
|
@ -17,15 +15,19 @@ from openstack_dashboard.dashboards.admin import dashboard
|
|||
class HostTopology(horizon.Panel):
|
||||
name = _("Provider Network Topology")
|
||||
slug = 'host_topology'
|
||||
permissions = ('openstack.services.platform',)
|
||||
permissions = ('openstack.services.platform', 'openstack.services.network')
|
||||
|
||||
def allowed(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
||||
return super(HostTopology, self).allowed(context)
|
||||
|
||||
def nav(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,8 +1,6 @@
|
|||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,9 +1,8 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -14,10 +14,6 @@
|
|||
#
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2015 Wind River Systems, Inc
|
||||
# Copyright 2015-2018 Wind River Systems, Inc
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@ -71,14 +71,16 @@ class CreateAddress(tables.LinkAction):
|
|||
|
||||
def allowed(self, request, datum=None):
|
||||
interface = self.table.get_interface()
|
||||
supported = interface.networktype.split(',')
|
||||
if not interface:
|
||||
return False
|
||||
if any(t in supported for t in ALLOWED_INTERFACE_TYPES):
|
||||
|
||||
if interface.networktype:
|
||||
supported = interface.networktype.split(',')
|
||||
if any(t in supported for t in ALLOWED_INTERFACE_TYPES):
|
||||
return True
|
||||
if getattr(interface, 'ipv4_mode', '') == 'static':
|
||||
return True
|
||||
if interface.ipv4_mode in ['static']:
|
||||
return True
|
||||
if interface.ipv6_mode in ['static']:
|
||||
if getattr(interface, 'ipv6_mode', '') == 'static':
|
||||
return True
|
||||
return False
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -14,10 +14,6 @@
|
|||
#
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -130,7 +128,7 @@ def get_attributes(interface):
|
|||
attrs.remove(a)
|
||||
attr_str = ",".join(attrs)
|
||||
|
||||
if 'False' in interface.dpdksupport:
|
||||
if False in interface.dpdksupport:
|
||||
attr_str = "%s, accelerated=%s" % (attr_str, 'False')
|
||||
else:
|
||||
attr_str = "%s, accelerated=%s" % (attr_str, 'True')
|
|
@ -16,10 +16,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -64,12 +62,6 @@ def get_processor_memory(memory):
|
|||
return template.loader.render_to_string(template_name, context)
|
||||
|
||||
|
||||
def get_vswitch_hugepages(memory):
|
||||
template_name = 'admin/inventory/memorys/_vswitchfunction_hugepages.html'
|
||||
context = {"memory": memory}
|
||||
return template.loader.render_to_string(template_name, context)
|
||||
|
||||
|
||||
def get_vm_hugepages(memory):
|
||||
template_name = 'admin/inventory/memorys/_vmfunction_hugepages.html'
|
||||
context = {"memory": memory}
|
||||
|
@ -83,9 +75,6 @@ class MemorysTable(tables.DataTable):
|
|||
memory = tables.Column(get_processor_memory,
|
||||
verbose_name=_('Memory'))
|
||||
|
||||
vswitch_huge = tables.Column(get_vswitch_hugepages,
|
||||
verbose_name=_('VSwitch Huge Pages'))
|
||||
|
||||
vm_huge = tables.Column(get_vm_hugepages,
|
||||
verbose_name=_('VM Pages'))
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2016 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
@ -22,12 +20,16 @@ class Inventory(horizon.Panel):
|
|||
permissions = ('openstack.services.platform',)
|
||||
|
||||
def allowed(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
||||
return super(Inventory, self).allowed(context)
|
||||
|
||||
def nav(self, context):
|
||||
if context['request'].user.services_region == 'SystemController':
|
||||
return False
|
||||
if not base.is_service_enabled(context['request'], 'platform'):
|
||||
return False
|
||||
else:
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -16,10 +16,6 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _ # noqa
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2014, 2017 Wind River Systems, Inc.
|
||||
# Copyright (c) 2013-2018 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
@ -183,6 +181,10 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
initial='idisk_uuid',
|
||||
widget=forms.widgets.HiddenInput)
|
||||
|
||||
tier_uuid = forms.CharField(label=_("tier_uuid"),
|
||||
initial='tier_uuid',
|
||||
widget=forms.widgets.HiddenInput)
|
||||
|
||||
hostname = forms.CharField(label=_("Hostname"),
|
||||
initial='hostname',
|
||||
widget=forms.TextInput(attrs={
|
||||
|
@ -200,7 +202,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
widget=forms.Select(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'disk'}),
|
||||
help_text=_("Assign disk to storage volume."))
|
||||
help_text=_("Assign disk to a storage volume."))
|
||||
|
||||
journal_locations = forms.ChoiceField(label=_("Journal"),
|
||||
required=False,
|
||||
|
@ -209,8 +211,9 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
'data-switch-on': 'function',
|
||||
'data-function-osd': _(
|
||||
"Journal")}),
|
||||
help_text=_("Assign disk to journal "
|
||||
"storage volume."))
|
||||
help_text=_("Assign disk to a "
|
||||
"journal storage "
|
||||
"volume."))
|
||||
|
||||
journal_size_mib = forms.CharField(label=_("Journal Size MiB"),
|
||||
required=False,
|
||||
|
@ -223,6 +226,15 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
help_text=_("Journal's size for the"
|
||||
"current OSD."))
|
||||
|
||||
tiers = forms.ChoiceField(label=_("Storage Tier"),
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'function',
|
||||
'data-function-osd':
|
||||
_("Storage Tier")}),
|
||||
help_text=_("Assign OSD to a storage tier."))
|
||||
|
||||
failure_url = 'horizon:admin:inventory:detail'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -260,6 +272,15 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
disk_model,
|
||||
d.device_type)))
|
||||
|
||||
# Get the cluster
|
||||
cluster_list = api.sysinv.cluster_list(self.request)
|
||||
cluster_uuid = cluster_list[0].uuid
|
||||
|
||||
# Populate the available tiers for OSD assignment
|
||||
avail_tier_list = api.sysinv.storage_tier_list(self.request,
|
||||
cluster_uuid)
|
||||
tier_tuple_list = [(t.uuid, t.name) for t in avail_tier_list]
|
||||
|
||||
# Populate available journal choices. If no journal is available,
|
||||
# then the journal is collocated.
|
||||
if ceph_caching:
|
||||
|
@ -285,6 +306,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
|
||||
self.fields['disks'].choices = disk_tuple_list
|
||||
self.fields['journal_locations'].choices = journal_tuple_list
|
||||
self.fields['tiers'].choices = tier_tuple_list
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(AddStorageVolume, self).clean()
|
||||
|
@ -299,10 +321,14 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
host_id = data['host_id']
|
||||
# host_uuid = data['ihost_uuid']
|
||||
disks = data['disks'][:] # copy
|
||||
tiers = data['tiers'][:] # copy
|
||||
|
||||
# GUI only allows one disk to be picked
|
||||
data['idisk_uuid'] = disks
|
||||
|
||||
# GUI only allows one tier to be picked
|
||||
data['tier_uuid'] = tiers
|
||||
|
||||
# Obtain journal information.
|
||||
journal = data['journal_locations'][:]
|
||||
|
||||
|
@ -315,6 +341,7 @@ class AddStorageVolume(forms.SelfHandlingForm):
|
|||
try:
|
||||
del data['host_id']
|
||||
del data['disks']
|
||||
del data['tiers']
|
||||
del data['hostname']
|
||||
del data['journal_locations']
|
||||
|
||||
|
@ -539,9 +566,16 @@ class AddPhysicalVolume(forms.SelfHandlingForm):
|
|||
partitions_tuple_list = []
|
||||
ilvg_tuple_list = []
|
||||
|
||||
pv_cinder_volumes = next(
|
||||
(pv for pv in ipv_list
|
||||
if pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES), None)
|
||||
|
||||
for lvg in ilvg_list:
|
||||
if (lvg.lvm_vg_name in compatible_lvgs and
|
||||
lvg.vg_state in [api.sysinv.LVG_ADD, api.sysinv.LVG_PROV]):
|
||||
if (lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES and
|
||||
pv_cinder_volumes):
|
||||
continue
|
||||
ilvg_tuple_list.append((lvg.uuid, lvg.lvm_vg_name))
|
||||
|
||||
for disk in avail_disk_list:
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from django.core.urlresolvers import reverse # noqa
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from django.conf.urls import url # noqa
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015, 2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -176,15 +174,26 @@ class EditPartition(tables.LinkAction):
|
|||
PARTITION_STATUS_MSG = api.sysinv.PARTITION_STATUS_MSG
|
||||
|
||||
if partition:
|
||||
pv = None
|
||||
|
||||
if partition.type_guid != api.sysinv.USER_PARTITION_PHYS_VOL:
|
||||
return False
|
||||
|
||||
if partition.ipv_uuid:
|
||||
pv = api.sysinv.host_pv_get(
|
||||
request, partition.ipv_uuid)
|
||||
if pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES:
|
||||
if (host.personality == "Controller-Active" and
|
||||
host._administrative == 'unlocked'):
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
if (partition.status ==
|
||||
PARTITION_STATUS_MSG[PARTITION_IN_USE_STATUS]):
|
||||
return False
|
||||
|
||||
if partition.ipv_uuid:
|
||||
return False
|
||||
if not (pv and
|
||||
pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES):
|
||||
return False
|
||||
|
||||
# Get all the partitions from the same disk.
|
||||
disk_partitions = \
|
||||
|
@ -421,14 +430,18 @@ class RemoveLocalVolumeGroup(tables.DeleteAction):
|
|||
|
||||
def allowed(self, request, lvg=None):
|
||||
host = self.table.kwargs['host']
|
||||
return ((((host._administrative == 'locked') or
|
||||
(('compute' in host._subfunctions) and
|
||||
(host.compute_config_required is True))) and
|
||||
(lvg.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL)) or
|
||||
((api.sysinv.CINDER_BACKEND_LVM in
|
||||
api.sysinv.get_cinder_backend(request)) and
|
||||
(lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES) and
|
||||
(api.sysinv.LVG_ADD in lvg.vg_state)))
|
||||
cinder_backend = api.sysinv.get_cinder_backend(request)
|
||||
|
||||
if lvg.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL:
|
||||
return ((host._administrative == 'locked')
|
||||
or
|
||||
(('compute' in host._subfunctions) and
|
||||
(host.compute_config_required is True)))
|
||||
elif lvg.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES:
|
||||
return (api.sysinv.CINDER_BACKEND_LVM not in cinder_backend and
|
||||
api.sysinv.LVG_ADD in lvg.vg_state)
|
||||
|
||||
return False
|
||||
|
||||
def delete(self, request, lvg_id):
|
||||
host_id = self.table.kwargs['host_id']
|
||||
|
@ -539,14 +552,18 @@ class RemovePhysicalVolume(tables.DeleteAction):
|
|||
|
||||
def allowed(self, request, pv=None):
|
||||
host = self.table.kwargs['host']
|
||||
return ((((host._administrative == 'locked') or
|
||||
(('compute' in host._subfunctions) and
|
||||
(host.compute_config_required is True))) and
|
||||
(pv.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL)) or
|
||||
((api.sysinv.CINDER_BACKEND_LVM in
|
||||
api.sysinv.get_cinder_backend(request)) and
|
||||
((pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES) and
|
||||
(api.sysinv.PV_ADD in pv.pv_state))))
|
||||
cinder_backend = api.sysinv.get_cinder_backend(request)
|
||||
|
||||
if pv.lvm_vg_name == api.sysinv.LVG_NOVA_LOCAL:
|
||||
return ((host._administrative == 'locked')
|
||||
or
|
||||
(('compute' in host._subfunctions) and
|
||||
(host.compute_config_required is True)))
|
||||
elif pv.lvm_vg_name == api.sysinv.LVG_CINDER_VOLUMES:
|
||||
return (api.sysinv.CINDER_BACKEND_LVM not in cinder_backend and
|
||||
api.sysinv.PV_ADD in pv.pv_state)
|
||||
|
||||
return False
|
||||
|
||||
def delete(self, request, pv_id):
|
||||
host_id = self.table.kwargs['host_id']
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
import logging
|
||||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
# Copyright (c) 2015 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from django.conf.urls import include # noqa
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2015, 2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
@ -168,6 +166,7 @@ class AddDiskProfileView(forms.ModalFormView):
|
|||
if count > 1:
|
||||
setattr(s, "count",
|
||||
journals[s.journal_location])
|
||||
setattr(s, "tier_name", s.tier_name)
|
||||
|
||||
s.disks = [d.device_path
|
||||
for d in all_disks if
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
import logging
|
|
@ -1,9 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2013-2017 Wind River Systems, Inc.
|
||||
#
|
||||
# The right to copy, distribute, modify, or otherwise make use
|
||||
# of this software may be licensed only pursuant to the terms
|
||||
# of an applicable Wind River license agreement.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue