Add blazar-status upgrade check command framework
This adds basic framework for blazar-status upgrade check commands. For now it has only "check_placeholder" check implemented. Real checks can be added to this tool in the future. Change-Id: I6f40be87eb7e20fb396191e60af023923eb9019a Story: 2003657 Task: 26121
This commit is contained in:
parent
44bc4383ab
commit
604b71520b
53
blazar/cmd/status.py
Normal file
53
blazar/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_config import cfg
|
||||||
|
from oslo_upgradecheck import upgradecheck
|
||||||
|
|
||||||
|
from blazar.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
class Checks(upgradecheck.UpgradeCommands):
|
||||||
|
|
||||||
|
"""Various upgrade checks should be added as separate methods in this class
|
||||||
|
|
||||||
|
and added to _upgrade_checks tuple.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def _check_placeholder(self):
|
||||||
|
# This is just a placeholder for upgrade checks, it should be
|
||||||
|
# removed when the actual checks are added
|
||||||
|
return upgradecheck.Result(upgradecheck.Code.SUCCESS)
|
||||||
|
|
||||||
|
# The format of the check functions is to return an
|
||||||
|
# oslo_upgradecheck.upgradecheck.Result
|
||||||
|
# object with the appropriate
|
||||||
|
# oslo_upgradecheck.upgradecheck.Code and details set.
|
||||||
|
# If the check hits warnings or failures then those should be stored
|
||||||
|
# in the returned Result's "details" attribute. The
|
||||||
|
# summary will be rolled up at the end of the check() method.
|
||||||
|
_upgrade_checks = (
|
||||||
|
# In the future there should be some real checks added here
|
||||||
|
(_('Placeholder'), _check_placeholder),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
return upgradecheck.main(
|
||||||
|
cfg.CONF, project='blazar', upgrade_command=Checks())
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
30
blazar/tests/cmd/test_status.py
Normal file
30
blazar/tests/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 blazar.cmd import status
|
||||||
|
from blazar import tests
|
||||||
|
|
||||||
|
|
||||||
|
class TestUpgradeChecks(tests.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestUpgradeChecks, self).setUp()
|
||||||
|
self.cmd = status.Checks()
|
||||||
|
|
||||||
|
def test__check_placeholder(self):
|
||||||
|
check_result = self.cmd._check_placeholder()
|
||||||
|
self.assertEqual(
|
||||||
|
Code.SUCCESS, check_result.code)
|
78
doc/source/cli/blazar-status.rst
Normal file
78
doc/source/cli/blazar-status.rst
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
=============
|
||||||
|
blazar-status
|
||||||
|
=============
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
========
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
blazar-status <category> <command> [<args>]
|
||||||
|
|
||||||
|
Description
|
||||||
|
===========
|
||||||
|
|
||||||
|
:program:`blazar-status` is a tool that provides routines for checking the
|
||||||
|
status of a Blazar deployment.
|
||||||
|
|
||||||
|
Options
|
||||||
|
=======
|
||||||
|
|
||||||
|
The standard pattern for executing a :program:`blazar-status` command is::
|
||||||
|
|
||||||
|
blazar-status <category> <command> [<args>]
|
||||||
|
|
||||||
|
Run without arguments to see a list of available command categories::
|
||||||
|
|
||||||
|
blazar-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::
|
||||||
|
|
||||||
|
blazar-status upgrade
|
||||||
|
|
||||||
|
These sections describe the available categories and arguments for
|
||||||
|
:program:`blazar-status`.
|
||||||
|
|
||||||
|
Upgrade
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
.. _blazar-status-checks:
|
||||||
|
|
||||||
|
``blazar-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 databases and services.
|
||||||
|
|
||||||
|
**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**
|
||||||
|
|
||||||
|
**3.0.0 (Stein)**
|
||||||
|
|
||||||
|
* Placeholder to be filled in with checks as they are added in Stein.
|
@ -6,3 +6,4 @@ Command-Line Interface Reference
|
|||||||
|
|
||||||
host-reservation
|
host-reservation
|
||||||
instance-reservation
|
instance-reservation
|
||||||
|
blazar-status
|
||||||
|
@ -61,6 +61,7 @@ oslo.middleware==3.31.0
|
|||||||
oslo.policy==1.30.0
|
oslo.policy==1.30.0
|
||||||
oslo.serialization==2.18.0
|
oslo.serialization==2.18.0
|
||||||
oslo.service==1.24.0
|
oslo.service==1.24.0
|
||||||
|
oslo.upgradecheck==0.1.0
|
||||||
oslo.utils==3.33.0
|
oslo.utils==3.33.0
|
||||||
oslotest==3.2.0
|
oslotest==3.2.0
|
||||||
Paste==2.0.3
|
Paste==2.0.3
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
prelude: >
|
||||||
|
Added new tool ``blazar-status upgrade check``.
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
New framework for ``blazar-status upgrade check`` command is added.
|
||||||
|
This framework allows adding various checks which can be run before a
|
||||||
|
Blazar upgrade to ensure if the upgrade can be performed safely.
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Operator can now use new CLI tool ``blazar-status upgrade check``
|
||||||
|
to check if Blazar deployment can be safely upgraded from
|
||||||
|
N-1 to N release.
|
@ -21,6 +21,7 @@ oslo.middleware>=3.31.0 # Apache-2.0
|
|||||||
oslo.policy>=1.30.0 # Apache-2.0
|
oslo.policy>=1.30.0 # Apache-2.0
|
||||||
oslo.serialization!=2.19.1,>=2.18.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.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.utils>=3.33.0 # Apache-2.0
|
||||||
python-novaclient>=9.1.0 # Apache-2.0
|
python-novaclient>=9.1.0 # Apache-2.0
|
||||||
netaddr>=0.7.18 # BSD
|
netaddr>=0.7.18 # BSD
|
||||||
|
@ -33,6 +33,7 @@ console_scripts =
|
|||||||
blazar-api=blazar.cmd.api:main
|
blazar-api=blazar.cmd.api:main
|
||||||
blazar-rpc-zmq-receiver=blazar.cmd.rpc_zmq_receiver:main
|
blazar-rpc-zmq-receiver=blazar.cmd.rpc_zmq_receiver:main
|
||||||
blazar-manager=blazar.cmd.manager:main
|
blazar-manager=blazar.cmd.manager:main
|
||||||
|
blazar-status=blazar.cmd.status:main
|
||||||
|
|
||||||
blazar.resource.plugins =
|
blazar.resource.plugins =
|
||||||
dummy.vm.plugin=blazar.plugins.dummy_vm_plugin:DummyVMPlugin
|
dummy.vm.plugin=blazar.plugins.dummy_vm_plugin:DummyVMPlugin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user