Merge remote-tracking branch 'starlingx/master' into f/centos8

Change-Id: Ide120995883b31caa66e8faba7cd20ce70ce7cc4
Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
Saul Wold 2020-02-05 08:36:05 -08:00
commit 209ddafc49
13 changed files with 23 additions and 238 deletions

View File

@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------
project = 'stx-gui'
project = u'StarlingX GUI'
copyright = '2018, StarlingX'
author = 'StarlingX'

View File

@ -1,25 +1,26 @@
=====================
stx-gui Documentation
StarlingX GUI Project
=====================
The StarlingX stx-gui project provides Horizon plugins for new StarlingX
services.
The starlingx/gui project provides Horizon plugins for new StarlingX services.
Release Notes
-------------
Release notes
-------------
.. toctree::
:maxdepth: 1
Release Notes <https://docs.starlingx.io/releasenotes/stx-gui>
Release notes <https://docs.starlingx.io/releasenotes/gui>
-----
Links
-----
* Source: `stx-gui`_
* Code Review: `Gerrit`_
* Bugs: `Storyboard`_
* Source: `starlingx/gui`_
* Code review: `Gerrit`_
* Project tracking: `Storyboard`_
.. _stx-gui: https://opendev.org/starlingx/gui
.. _starlingx/gui: https://opendev.org/starlingx/gui
.. _Gerrit: https://review.opendev.org/#/q/project:starlingx/gui
.. _Storyboard: https://storyboard.openstack.org/#!/project/starlingx/gui

View File

@ -46,7 +46,7 @@ source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
project = 'stx-gui'
project = u'StarlingX GUI'
# Release notes are version independent, no need to set version and release
release = ''

View File

@ -1,6 +1,6 @@
=====================
stx-gui Release Notes
=====================
===========================
StarlingX GUI Release Notes
===========================
.. toctree::
:maxdepth: 2

View File

@ -1,56 +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) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from django import template
from django.utils.translation import ugettext_lazy as _
from horizon import tables
class ControllerServiceFilterAction(tables.FilterAction):
def filter(self, table, services, filter_string):
q = filter_string.lower()
def comp(service):
if q in service.type.lower():
return True
return False
return filter(comp, services)
def cs_get_c0(iservice):
template_name = 'controller_services/_services_c0.html'
context = {"iservice": iservice}
return template.loader.render_to_string(template_name, context)
def cs_get_c1(iservice):
template_name = 'controller_services/_services_c1.html'
context = {"iservice": iservice}
return template.loader.render_to_string(template_name, context)
class ControllerServicesTable(tables.DataTable):
servicename = tables.Column("servicename", verbose_name=_('Name'))
c0 = tables.Column(cs_get_c0, verbose_name=_('controller-0'))
c1 = tables.Column(cs_get_c1, verbose_name=_('controller-1'))
class Meta(object):
name = "controller_services"
verbose_name = _("Controller Services")
table_actions = (ControllerServiceFilterAction,)
multi_select = False

View File

@ -1,143 +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) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from starlingx_dashboard.api import iservice
from starlingx_dashboard.api import sysinv as sysinv_api
from starlingx_dashboard.dashboards.admin.controller_services import tables
from starlingx_dashboard.utils import objectify
import logging
LOG = logging.getLogger(__name__)
class ControllerServicesTab(tabs.TableTab):
table_classes = (tables.ControllerServicesTable,)
name = _("Controller Services")
slug = "controller_services"
template_name = ("horizon/common/_detail_table.html")
permissions = ('openstack.services.smapi',)
def _find_service_group_names(self, sdas):
service_group_names_set = set()
for sda in sdas:
service_group_names_set.add(sda.service_group_name)
service_group_names_list = list(service_group_names_set)
return service_group_names_list
def _update_service_group_states(self, service_group_name, sdas, nodes):
entry = {}
for sda in sdas:
for n in nodes:
if n.name == sda.node_name:
if n.administrative_state.lower() == "locked":
dstate = "locked"
elif n.operational_state.lower() == "enabled":
dstate = "standby"
else:
dstate = n.operational_state.lower()
if sda.service_group_name == service_group_name:
state_str = sda.state
if sda.status != "":
state_str += '-' + sda.status
if sda.condition != "":
state_str += ' [' + sda.condition + ']'
if sda.state == "active":
if sda.node_name == "controller-0":
entry.update({'c0_activity': 'active'})
entry.update({'c0_hostname': sda.node_name})
entry.update({'c0_state': state_str})
elif sda.node_name == "controller-1":
entry.update({'c1_activity': 'active'})
entry.update({'c1_hostname': sda.node_name})
entry.update({'c1_state': state_str})
else:
if dstate == "standby":
dstate = state_str
if sda.node_name == "controller-0":
entry.update({'c0_activity': sda.state})
entry.update({'c0_hostname': sda.node_name})
entry.update({'c0_state': dstate})
elif sda.node_name == "controller-1":
entry.update({'c1_activity': sda.state})
entry.update({'c1_hostname': sda.node_name})
entry.update({'c1_state': dstate})
return entry
def get_controller_services_data(self):
"""Populate the data for the controller services tab"""
# Here we filter the controller-1 column if we're a simplex system
# We should make this data driven in the future. This would allow us to
# more easily support n controllers
if sysinv_api.is_system_mode_simplex(self.tab_group.request):
controller1_col = self._tables['controller_services'].columns['c1']
controller1_col.classes.append("hide")
try:
nodes = iservice.sm_nodes_list(self.tab_group.request)
sdas = iservice.sm_sda_list(self.tab_group.request)
services = []
sgs = self._find_service_group_names(sdas)
sdaid = 0
for sg in sgs:
sdaid += 1
entry = {}
entry.update({'id': sdaid})
entry.update({'servicename': sg})
sg_states = self._update_service_group_states(sg, sdas, nodes)
entry.update(sg_states)
# Need to latch if any sg is enabled
if 'c0_activity' in entry.keys():
sgstate = entry['c0_activity']
if sgstate == "active":
entry.update({'sgstate': sgstate})
elif 'c1_activity' in entry.keys():
sgstate = entry['c1_activity']
if sgstate == "active":
entry.update({'sgstate': sgstate})
if sgstate != "active":
entry.update({'sgstate': sgstate})
if entry != {}:
entry_object = objectify.objectify(entry)
services.append(entry_object)
except Exception:
msg = _('Unable to get controller services list.')
exceptions.check_message(["Connection", "refused"], msg)
raise
return services

View File

@ -1,3 +0,0 @@
{% if iservice.c0_hostname == "controller-0" %}
{{ iservice.c0_state|linebreaksbr }}
{% endif %}

View File

@ -1,3 +0,0 @@
{% if iservice.c1_hostname == "controller-1" %}
{{ iservice.c1_state|linebreaksbr }}
{% endif %}

View File

@ -1,16 +0,0 @@
# The slug of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'info'
# The slug of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'admin'
# The slug of the panel group the PANEL is associated with.
PANEL_GROUP = 'admin'
ADD_INSTALLED_APPS = \
['starlingx_dashboard.dashboards.admin.controller_services', ]
EXTRA_TABS = {
'openstack_dashboard.dashboards.admin.info.tabs.SystemInfoTabs': (
'starlingx_dashboard.dashboards.admin.controller_services.tabs.'
'ControllerServicesTab',
),
}

View File

@ -0,0 +1,4 @@
PANEL = 'info'
PANEL_DASHBOARD = 'admin'
PANEL_GROUP = 'admin'
REMOVE_PANEL = True

View File

@ -91,6 +91,7 @@ OPERATION_LOG_OPTIONS = {
'mask_fields': ['password', 'bm_password', 'bm_confirm_password',
'current_password', 'confirm_password', 'new_password',
'fake_password'],
'ignore_urls': [],
'target_methods': ['POST', 'PUT', 'DELETE'],
'format': ("[%(project_name)s %(project_id)s] [%(user_name)s %(user_id)s]"
" [%(method)s %(request_url)s %(http_status)s]"

View File

@ -9,8 +9,8 @@ stxdir = {toxinidir}/..
[testenv]
install_command = pip install \
-v -v -v \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
-U {opts} {packages}
-c https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt \
{opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
@ -56,7 +56,6 @@ basepython = python2.7
usedevelop = False
skip_install = True
deps = {[testenv]deps}
git+git://github.com/starlingx-staging/stx-horizon.git
-e{[tox]stxdir}/{env:STX_DC_CLIENT}/distributedcloud-client
-e{[tox]stxdir}/config/sysinv/cgts-client/cgts-client
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
@ -65,6 +64,7 @@ deps = {[testenv]deps}
-e{[tox]stxdir}/nfv/nfv/nfv-client
-e{[tox]stxdir}/ha/service-mgmt-client/sm-client
-e{[tox]stxdir}/utilities/ceph/python-cephclient/python-cephclient
horizon==15.2.0
requests-toolbelt
pylint
commands =