Add placement-status upgrade check command
This adds the basic framework for the placement-status upgrade check command which is a community-wide goal for the Stein release. A simple placeholder check is added which should be replaced later when we have a real upgrade check. Change-Id: I9291386fe7fcbfc035c104ea9fdbe5eb875c4776 Story: 2003657 Task: 27518
This commit is contained in:
parent
7b5218d8e3
commit
3ff9d0a5a0
@ -22,4 +22,5 @@ utilities:
|
|||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
placement-manage
|
placement-manage
|
||||||
|
placement-status
|
||||||
|
|
||||||
|
91
doc/source/cli/placement-status.rst
Normal file
91
doc/source/cli/placement-status.rst
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
..
|
||||||
|
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.
|
||||||
|
|
||||||
|
================
|
||||||
|
placement-status
|
||||||
|
================
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
========
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
placement-status <category> <command> [<args>]
|
||||||
|
|
||||||
|
Description
|
||||||
|
===========
|
||||||
|
|
||||||
|
:program:`placement-status` is a tool that provides routines for checking the
|
||||||
|
status of a Placement deployment.
|
||||||
|
|
||||||
|
Options
|
||||||
|
=======
|
||||||
|
|
||||||
|
The standard pattern for executing a :program:`placement-status` command is::
|
||||||
|
|
||||||
|
placement-status <category> <command> [<args>]
|
||||||
|
|
||||||
|
Run without arguments to see a list of available command categories::
|
||||||
|
|
||||||
|
placement-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::
|
||||||
|
|
||||||
|
placement-status upgrade
|
||||||
|
|
||||||
|
These sections describe the available categories and arguments for
|
||||||
|
:program:`placement-status`.
|
||||||
|
|
||||||
|
Upgrade
|
||||||
|
~~~~~~~
|
||||||
|
|
||||||
|
.. _placement-status-checks:
|
||||||
|
|
||||||
|
``placement-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**
|
||||||
|
|
||||||
|
**1.0.0 (Stein)**
|
||||||
|
|
||||||
|
* Placeholder to be filled in with checks as they are added in Stein.
|
@ -198,9 +198,10 @@ The following sub-sections provide notes on upgrading to a given target release.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
As a reminder, the `nova-status upgrade check`_ tool can be used to help
|
As a reminder, the
|
||||||
determine the status of your deployment and how ready it is to perform an
|
:ref:`placement-status upgrade check <placement-status-checks>` tool can be
|
||||||
upgrade.
|
used to help determine the status of your deployment and how ready it is to
|
||||||
|
perform an upgrade.
|
||||||
|
|
||||||
Ocata (15.0.0)
|
Ocata (15.0.0)
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
@ -312,7 +313,6 @@ Stein (19.0.0)
|
|||||||
* The default configuration value of ``[placement]/policy_file`` is changed
|
* The default configuration value of ``[placement]/policy_file`` is changed
|
||||||
from ``placement-policy.yaml`` to ``policy.yaml``
|
from ``placement-policy.yaml`` to ``policy.yaml``
|
||||||
|
|
||||||
.. _`nova-status upgrade check`: https://docs.openstack.org/nova/latest/cli/nova-status.html
|
|
||||||
.. _`its own repository`: https://git.openstack.org/cgit/openstack/placement
|
.. _`its own repository`: https://git.openstack.org/cgit/openstack/placement
|
||||||
|
|
||||||
REST API
|
REST API
|
||||||
|
@ -90,6 +90,7 @@ oslo.reports==1.18.0
|
|||||||
oslo.rootwrap==5.8.0
|
oslo.rootwrap==5.8.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.1
|
||||||
oslo.utils==3.37.0
|
oslo.utils==3.37.0
|
||||||
oslo.versionedobjects==1.31.2
|
oslo.versionedobjects==1.31.2
|
||||||
oslo.vmware==2.17.0
|
oslo.vmware==2.17.0
|
||||||
|
55
placement/cmd/status.py
Normal file
55
placement/cmd/status.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# 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 placement.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
class Checks(upgradecheck.UpgradeCommands):
|
||||||
|
"""Checks for the ``placement-status upgrade check`` command.
|
||||||
|
|
||||||
|
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 = (
|
||||||
|
# TODO(mriedem) In the future there should be some real checks added
|
||||||
|
# here, for example, making sure all resource providers have a
|
||||||
|
# root_provider_id set before the nested RPs compatibility code is
|
||||||
|
# removed. See bug 1799892 for details.
|
||||||
|
(_('Placeholder'), _check_placeholder),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
return upgradecheck.main(
|
||||||
|
cfg.CONF, project='placement', upgrade_command=Checks())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
32
placement/tests/unit/cmd/test_status.py
Normal file
32
placement/tests/unit/cmd/test_status.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# 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
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from placement.cmd import status
|
||||||
|
|
||||||
|
|
||||||
|
class TestUpgradeChecks(testtools.TestCase):
|
||||||
|
"""Basic tests for the upgrade check framework.
|
||||||
|
|
||||||
|
The heavy lifting is done in the oslo.upgradecheck library and the
|
||||||
|
tests here do not attempt to test the internals of the library code.
|
||||||
|
"""
|
||||||
|
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)
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
A ``placement-status upgrade check`` command is added which can be used
|
||||||
|
to check the readiness of a placement deployment before initiating an
|
||||||
|
upgrade.
|
@ -21,6 +21,7 @@ oslo.db>=4.40.0 # Apache-2.0
|
|||||||
oslo.policy>=1.35.0 # Apache-2.0
|
oslo.policy>=1.35.0 # Apache-2.0
|
||||||
oslo.i18n>=3.15.3 # Apache-2.0
|
oslo.i18n>=3.15.3 # Apache-2.0
|
||||||
oslo.middleware>=3.31.0 # Apache-2.0
|
oslo.middleware>=3.31.0 # Apache-2.0
|
||||||
|
oslo.upgradecheck>=0.1.1 # Apache-2.0
|
||||||
oslo.versionedobjects>=1.31.2 # Apache-2.0
|
oslo.versionedobjects>=1.31.2 # Apache-2.0
|
||||||
os-traits>=0.4.0 # Apache-2.0
|
os-traits>=0.4.0 # Apache-2.0
|
||||||
microversion-parse>=0.2.1 # Apache-2.0
|
microversion-parse>=0.2.1 # Apache-2.0
|
||||||
|
@ -41,8 +41,8 @@ oslo.policy.policies =
|
|||||||
placement = placement.policies:list_rules
|
placement = placement.policies:list_rules
|
||||||
|
|
||||||
console_scripts =
|
console_scripts =
|
||||||
# TODO(cdent): We will need some kind of placement-status, eventually
|
|
||||||
placement-manage = placement.cmd.manage:main
|
placement-manage = placement.cmd.manage:main
|
||||||
|
placement-status = placement.cmd.status:main
|
||||||
wsgi_scripts =
|
wsgi_scripts =
|
||||||
placement-api = placement.wsgi:init_application
|
placement-api = placement.wsgi:init_application
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user