commit
3ac1bea967
@ -0,0 +1,59 @@
|
||||
..
|
||||
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.
|
||||
|
||||
|
||||
Convention for heading levels in Neutron devref:
|
||||
======= Heading 0 (reserved for the title in a document)
|
||||
------- Heading 1
|
||||
~~~~~~~ Heading 2
|
||||
+++++++ Heading 3
|
||||
''''''' Heading 4
|
||||
(Avoid deeper levels because they do not render well.)
|
||||
|
||||
.. _upgrade_checks:
|
||||
|
||||
Upgrade checks
|
||||
==============
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
CLI tool ``neutron-status upgrade check`` contains checks which perform a
|
||||
release-specific readiness check before restarting services with new code.
|
||||
For more details see `neutron-status command-line client
|
||||
</cli/neutron-status.html>`_ page.
|
||||
|
||||
3rd party plugins checks
|
||||
------------------------
|
||||
|
||||
Neutron upgrade checks script allows to add checks by stadium and 3rd party
|
||||
projects.
|
||||
The ``neutron-status`` script detects which sub-projects have been installed by
|
||||
enumerating the ``neutron.status.upgrade.checks`` entrypoints. For more details
|
||||
see the `Entry Points section of Contributing extensions to Neutron
|
||||
<contribute.html#entry-points>`_.
|
||||
Checks can be run in random order and should be independent from each other.
|
||||
|
||||
The recommended entry point name is a repository name: For example,
|
||||
'neutron-fwaas' for FWaaS and 'networking-sfc' for SFC:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
neutron.status.upgrade.checks =
|
||||
neutron-fwaas = neutron_fwaas.upgrade.checks:Checks
|
||||
|
||||
Entrypoint should be class which inherits from
|
||||
``neutron.cmd.upgrade_checks.base.BaseChecks``.
|
||||
|
||||
An example of a checks class can be found in
|
||||
``neutron.cmd.upgrade_checks.checks.CoreChecks``.
|
@ -0,0 +1,36 @@
|
||||
# Copyright 2018 Red Hat Inc.
|
||||
#
|
||||
# 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 abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseChecks(object):
|
||||
|
||||
"""Base class providing upgrade checks.
|
||||
|
||||
Stadium projects which want to provide their own upgrade checks to
|
||||
neutron-status CLI tool should inherit from this class.
|
||||
|
||||
Each check method have to accept neutron.cmd.status.Checker
|
||||
class as an argument because all checkes will be run in context of
|
||||
this class.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_checks(self):
|
||||
"""Get tuple with check methods and check names to run."""
|
||||
pass
|
@ -0,0 +1,33 @@
|
||||
# Copyright 2018 Red Hat Inc.
|
||||
#
|
||||
# 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 import upgradecheck
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.cmd.upgrade_checks import base
|
||||
|
||||
|
||||
class CoreChecks(base.BaseChecks):
|
||||
|
||||
def get_checks(self):
|
||||
return (
|
||||
(_("Check nothing"), self.noop_check)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def noop_check(checker):
|
||||
# NOTE(slaweq) This is only example Noop check, it can be removed when
|
||||
# some real check methods will be added
|
||||
return upgradecheck.Result(
|
||||
upgradecheck.Code.SUCCESS, _("Always succeed (placeholder)"))
|
@ -0,0 +1,33 @@
|
||||
# Copyright 2018 Red Hat Inc.
|
||||
#
|
||||
# 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 mock
|
||||
from oslo_upgradecheck.upgradecheck import Code
|
||||
|
||||
from neutron.cmd.upgrade_checks import checks
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
class TestChecks(base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestChecks, self).setUp()
|
||||
self.checks = checks.CoreChecks()
|
||||
|
||||
def test_get_checks_list(self):
|
||||
self.assertIsInstance(self.checks.get_checks(), tuple)
|
||||
|
||||
def test_noop_check(self):
|
||||
check_result = checks.CoreChecks.noop_check(mock.Mock())
|
||||
self.assertEqual(Code.SUCCESS, check_result.code)
|
Loading…
Reference in new issue