Skip to content

Commit

Permalink
Implement scaffolding for upgrade checks
Browse files Browse the repository at this point in the history
One of the community goals for Stein is to implement a command-line
tool for operators that runs programmable checks that might impact
upgradability.

This commit lays down the basic structure for the upgrade checks and
ties it up to `glance-status` command.

Change-Id: I7fcf5235a76d15dbcb2c49255bc26c2b586cd71c
Story: 2003657
Task: 26135
  • Loading branch information
lbragstad authored and mriedem committed Dec 5, 2018
1 parent 509d494 commit c82ecc7
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 0 deletions.
95 changes: 95 additions & 0 deletions doc/source/cli/glancestatus.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=============
glance-status
=============

---------------------
Glance Status Utility
---------------------

.. include:: header.txt

SYNOPSIS
========

::

glance-status [options]

DESCRIPTION
===========

``glance-status`` is a command line utility to aid operators in upgrading
glance by running programmable checks for things that might prevent upgrades.

COMMANDS
========

``upgrade``
This is the prefix for checking the glance deployment for any upgrade
issues that might prevent glance from upgrading.

You can also run with a category argument such as ``upgrade`` to see a list of
all commands in that category::

glance-status upgrade

These sections describe the available categories and arguments for
:command:`glance-status`.

Categories and commands
-----------------------

``glance-status upgrade check``
Performs a release-specific readiness check before restarting services with
new code, or upgrading. This command expects to have complete configuration
and access to the database.

**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**

**18.0.0 (Stein)**

* Placeholder to be filled in with checks as they are added in Stein.

OPTIONS
=======

**General Options**

``-h, --help``
show this help message and exit

``--config-dir DIR``
Path to a config directory to pull `*.conf` files from.
This file set is sorted, so as to provide a predictable
parse order if individual options are over-ridden. The
set is parsed after the file(s) specified via previous
--config-file, arguments hence over-ridden options in
the directory take precedence.

``--config-file PATH``
Path to a config file to use. Multiple config files can
be specified, with values in later files taking
precedence. Defaults to None.

.. include:: footer.txt
28 changes: 28 additions & 0 deletions glance/cmd/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python

# 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_config import cfg
from oslo_upgradecheck import upgradecheck

CONF = cfg.CONF


class Checks(upgradecheck.UpgradeCommands):
"""Programmable upgrade checks."""

pass


def main():
return upgradecheck.main(CONF, 'glance', Checks())
1 change: 1 addition & 0 deletions lower-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ oslo.middleware==3.31.0
oslo.policy==1.30.0
oslo.serialization==2.25.0
oslo.service==1.30.0
oslo.upgradecheck==0.1.0
oslo.utils==3.33.0
oslotest==3.2.0
osprofiler==1.4.0
Expand Down
9 changes: 9 additions & 0 deletions releasenotes/notes/bp-upgrade-checks-b3272c3ddb4e8cf7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
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 ``glance-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.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ httplib2>=0.9.1 # MIT
oslo.config>=5.2.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
oslo.context>=2.19.2 # Apache-2.0
oslo.upgradecheck>=0.1.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
stevedore>=1.20.0 # Apache-2.0
futurist>=1.2.0 # Apache-2.0
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ console_scripts =
glance-registry = glance.cmd.registry:main
glance-replicator = glance.cmd.replicator:main
glance-scrubber = glance.cmd.scrubber:main
glance-status = glance.cmd.status:main
wsgi_scripts =
glance-wsgi-api = glance.common.wsgi_app:init_app
glance.common.image_location_strategy.modules =
Expand Down

0 comments on commit c82ecc7

Please sign in to comment.