Base framework for cinder-status upgrade check

This adds the cinder-status CLI for performing upgrade checks as part of
the Stein cycle upgrade-checkers goal. It only includes a placeholder
for actual checks. Follow up patches will need to be added for anything
we identify as needing specific checking.

Story: 2003657
Task: 26123
Change-Id: I2e532d313d12e60848b17e869882e52ec456929b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-09-21 14:37:48 -05:00 committed by Matt Riedemann
parent a9467860b5
commit 1729c889c2
8 changed files with 162 additions and 1 deletions

47
cinder/cmd/status.py Normal file
View File

@ -0,0 +1,47 @@
# Copyright 2018 Huawei Technologies Co., Ltd.
# All Rights Reserved.
#
# 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.
"""CLI interface for cinder status commands."""
import sys
from oslo_config import cfg
from oslo_upgradecheck import upgradecheck as uc
CONF = cfg.CONF
SUCCESS = uc.Code.SUCCESS
FAILURE = uc.Code.FAILURE
WARNING = uc.Code.WARNING
class Checks(uc.UpgradeCommands):
"""Upgrade checks to run."""
def _check_placeholder(self):
"""This is just a placeholder to test the test framework."""
return uc.Result(SUCCESS, 'Some details')
_upgrade_checks = (
('Placeholder', _check_placeholder),
)
def main():
return uc.main(CONF, 'cinder', Checks())
if __name__ == '__main__':
sys.exit(main())

View File

@ -0,0 +1,98 @@
=============
cinder-status
=============
----------------------------------------
CLI interface for cinder status commands
----------------------------------------
:Author: openstack@lists.openstack.org
:Copyright: OpenStack Foundation
:Manual section: 1
:Manual group: cloud computing
Synopsis
========
::
cinder-status <category> <action> [<args>]
Description
===========
:program:`cinder-status` is a tool that provides routines for checking the
status of a Cinder deployment.
Options
=======
The standard pattern for executing a :program:`cinder-status` command is::
cinder-status <category> <command> [<args>]
Run without arguments to see a list of available command categories::
cinder-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::
cinder-status upgrade
These sections describe the available categories and arguments for
:program:`cinder-status`.
Upgrade
~~~~~~~
.. _cinder-status-checks:
``cinder-status upgrade check``
Performs a release-specific readiness check before restarting services with
new code. This command expects to have complete configuration and access
to the database. It may also make requests to other services' REST API via
the Keystone service catalog.
**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**
**14.0.0 (Stein)**
* Placeholder to be filled in with checks as they are added in Stein.
See Also
========
* `OpenStack Cinder <https://docs.openstack.org/cinder/>`_
Bugs
====
* Cinder bugs are managed at `Launchpad <https://bugs.launchpad.net/cinder>`_

View File

@ -15,6 +15,7 @@ Cinder database.
:maxdepth: 1
cinder-manage
cinder-status
Additional Tools and Information
--------------------------------

View File

@ -150,7 +150,9 @@ modindex_common_prefix = ['cinder.']
man_pages = [
('cli/cinder-manage', 'cinder-manage', u'Cloud controller fabric',
[u'OpenStack'], 1)
[u'OpenStack'], 1),
('cli/cinder-status', 'cinder-status', u'Upgrade checking utility',
[u'OpenStack'], 1),
]
# -- Options for HTML output --------------------------------------------------

View File

@ -163,3 +163,4 @@ voluptuous==0.11.1
warlock==1.3.0
WebOb==1.7.1
wrapt==1.10.11
oslo.upgradecheck==0.1.0

View File

@ -0,0 +1,10 @@
---
features:
- |
[`Community Goal <https://governance.openstack.org/tc/goals/stein/upgrade-checkers.html>`_]
Support has been added for developers to write pre-upgrade checks.
Operators can run these checks using ``cinder-status upgrade check``.
This allows operators to be more confident when upgrading their deployments
by having a tool that automates programmable checks against the deployment
configuration or dataset.

View File

@ -30,6 +30,7 @@ oslo.reports>=1.18.0 # Apache-2.0
oslo.rootwrap>=5.8.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.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
osprofiler>=1.4.0 # Apache-2.0

View File

@ -67,6 +67,7 @@ console_scripts =
cinder-rootwrap = oslo_rootwrap.cmd:main
cinder-rtstool = cinder.cmd.rtstool:main
cinder-scheduler = cinder.cmd.scheduler:main
cinder-status = cinder.cmd.status:main
cinder-volume = cinder.cmd.volume:main
cinder-volume-usage-audit = cinder.cmd.volume_usage_audit:main
wsgi_scripts =