Add framework for masakari-status upgrade check
This commit adds the functionality of masakari-status CLI for performing upgrade checks as part of the Stein cycle upgrade-checkers goal. It only includes a sample check which must be replaced by real checks in future. Change-Id: I17c79af15eca5f6da7e32dbedbdc392c97114d42 Story: 2003657 Task: 26140
This commit is contained in:
parent
d8bb02ce0e
commit
7700cdd3bf
11
doc/source/cli/index.rst
Normal file
11
doc/source/cli/index.rst
Normal file
@ -0,0 +1,11 @@
|
||||
==========================
|
||||
Masakari CLI Documentation
|
||||
==========================
|
||||
|
||||
In this section you will find information on Masakari’s command line
|
||||
interface.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
masakari-status
|
83
doc/source/cli/masakari-status.rst
Normal file
83
doc/source/cli/masakari-status.rst
Normal file
@ -0,0 +1,83 @@
|
||||
===============
|
||||
masakari-status
|
||||
===============
|
||||
|
||||
------------------------------------------
|
||||
CLI interface for Masakari status commands
|
||||
------------------------------------------
|
||||
|
||||
Synopsis
|
||||
========
|
||||
|
||||
::
|
||||
|
||||
masakari-status <category> <command> [<args>]
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
:program:`masakari-status` is a tool that provides routines for checking the
|
||||
status of a Masakari deployment.
|
||||
|
||||
Options
|
||||
=======
|
||||
|
||||
The standard pattern for executing a :program:`masakari-status` command is::
|
||||
|
||||
masakari-status <category> <command> [<args>]
|
||||
|
||||
Run without arguments to see a list of available command categories::
|
||||
|
||||
masakari-status
|
||||
|
||||
Categories are:
|
||||
|
||||
* ``upgrade``
|
||||
|
||||
Detailed descriptions are below:
|
||||
|
||||
You can also run with a category argument such as ``upgrade`` to see a list of
|
||||
all commands in that category::
|
||||
|
||||
masakari-status upgrade
|
||||
|
||||
These sections describe the available categories and arguments for
|
||||
:program:`masakari-status`.
|
||||
|
||||
Upgrade
|
||||
~~~~~~~
|
||||
|
||||
.. _masakari-status-checks:
|
||||
|
||||
``masakari-status upgrade check``
|
||||
Performs a release-specific readiness check before restarting services with
|
||||
new code. For example, missing or changed configuration options,
|
||||
incompatible object states, or other conditions that could lead to
|
||||
failures while upgrading.
|
||||
|
||||
**Return Codes**
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
||||
* - Return code
|
||||
- Description
|
||||
* - 0
|
||||
- All upgrade readiness checks passed successfully and there is nothing
|
||||
to do.
|
||||
* - 1
|
||||
- At least one check encountered an issue and requires further
|
||||
investigation. This is considered a warning but the upgrade may be OK.
|
||||
* - 2
|
||||
- There was an upgrade status check failure that needs to be
|
||||
investigated. This should be considered something that stops an
|
||||
upgrade.
|
||||
* - 255
|
||||
- An unexpected error occurred.
|
||||
|
||||
**History of Checks**
|
||||
|
||||
**7.0.0 (Stein)**
|
||||
|
||||
* Sample check to be filled in with checks as they are added in Stein.
|
@ -66,6 +66,7 @@ This section will help you in configuring masakari mannualy.
|
||||
:maxdepth: 1
|
||||
|
||||
operators_guide
|
||||
cli/index
|
||||
sample_config
|
||||
sample_policy
|
||||
recovery_workflow_sample_config
|
||||
|
@ -62,6 +62,7 @@ oslo.middleware==3.31.0
|
||||
oslo.policy==1.30.0
|
||||
oslo.serialization==2.25.0
|
||||
oslo.service==1.24.0
|
||||
oslo.upgradecheck==0.1.0
|
||||
oslo.utils==3.33.0
|
||||
oslo.versionedobjects==1.31.2
|
||||
oslosphinx==4.7.0
|
||||
|
53
masakari/cmd/status.py
Normal file
53
masakari/cmd/status.py
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2018 NEC, Corp.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
|
||||
from oslo_upgradecheck import upgradecheck
|
||||
|
||||
from masakari import conf
|
||||
from masakari.i18n import _
|
||||
|
||||
CONF = conf.CONF
|
||||
|
||||
|
||||
class Checks(upgradecheck.UpgradeCommands):
|
||||
|
||||
"""Contains upgrade checks
|
||||
|
||||
Various upgrade checks should be added as separate methods in this class
|
||||
and added to _upgrade_checks tuple.
|
||||
"""
|
||||
|
||||
def _sample_check(self):
|
||||
"""This is sample check added to test the upgrade check framework
|
||||
|
||||
It needs to be removed after adding any real upgrade check
|
||||
"""
|
||||
return upgradecheck.Result(upgradecheck.Code.SUCCESS, 'Sample detail')
|
||||
|
||||
_upgrade_checks = (
|
||||
# Sample check added for now.
|
||||
# Whereas in future real checks must be added here in tuple
|
||||
(_('Sample Check'), _sample_check),
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
return upgradecheck.main(
|
||||
CONF, project='masakari', upgrade_command=Checks())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
30
masakari/tests/unit/cmd/test_status.py
Normal file
30
masakari/tests/unit/cmd/test_status.py
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright (c) 2018 NEC, Corp.
|
||||
#
|
||||
# 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.
|
||||
|
||||
from oslo_upgradecheck.upgradecheck import Code
|
||||
|
||||
from masakari.cmd import status
|
||||
from masakari import test
|
||||
|
||||
|
||||
class TestUpgradeChecks(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestUpgradeChecks, self).setUp()
|
||||
self.cmd = status.Checks()
|
||||
|
||||
def test__sample_check(self):
|
||||
check_result = self.cmd._sample_check()
|
||||
self.assertEqual(
|
||||
Code.SUCCESS, check_result.code)
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
prelude: >
|
||||
Added new tool ``masakari-status upgrade check``.
|
||||
features:
|
||||
- |
|
||||
New framework for ``masakari-status upgrade check`` command is added.
|
||||
This framework allows adding various checks which can be run before a
|
||||
Masakari upgrade to ensure if the upgrade can be performed safely.
|
||||
upgrade:
|
||||
- |
|
||||
Operator can now use new CLI tool ``masakari-status upgrade check``
|
||||
to check if Masakari deployment can be safely upgraded from
|
||||
N-1 to N release.
|
@ -18,6 +18,7 @@ oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.middleware>=3.31.0 # Apache-2.0
|
||||
oslo.policy>=1.30.0 # Apache-2.0
|
||||
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
|
||||
oslo.upgradecheck>=0.1.0 # Apache-2.0
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
oslo.versionedobjects>=1.31.2 # Apache-2.0
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user