Merge "Fix ironic-status db index check"

This commit is contained in:
Zuul 2021-06-14 02:11:08 +00:00 committed by Gerrit Code Review
commit 59218ce523
2 changed files with 25 additions and 16 deletions

View File

@ -74,7 +74,15 @@ upgrade_project ironic $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# NOTE(rloo): make sure it is OK to do an upgrade. Except that we aren't # NOTE(rloo): make sure it is OK to do an upgrade. Except that we aren't
# parsing/checking the output of this command because the output could change # parsing/checking the output of this command because the output could change
# based on the checks it makes. # based on the checks it makes.
$IRONIC_BIN_DIR/ironic-status upgrade check $IRONIC_BIN_DIR/ironic-status upgrade check && ret_val=$? || ret_val=$?
if [ $ret_val -gt 1 ] ; then
# NOTE(TheJulia): We need to evaluate the return code from the
# upgrade status check as the framework defines
# Warnings are permissible and returned as status code 1, errors are
# returned as greater than 1 which means there is a major upgrade
# stopping issue which needs to be addressed.
die $LINENO "Ironic DB Status check failed, returned: $ret_val"
fi
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE $IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE

View File

@ -51,21 +51,6 @@ class Checks(upgradecheck.UpgradeCommands):
else: else:
return upgradecheck.Result(upgradecheck.Code.FAILURE, details=msg) return upgradecheck.Result(upgradecheck.Code.FAILURE, details=msg)
# A tuple of check tuples of (<name of check>, <check function>).
# The name of the check will be used in the output of this command.
# The check function takes no arguments and returns an
# oslo_upgradecheck.upgradecheck.Result object with the appropriate
# oslo_upgradecheck.upgradecheck.Code and details set. If the
# check function 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 = (
(_('Object versions'), _check_obj_versions),
# Victoria -> Wallaby migration
(_('Policy File JSON to YAML Migration'),
(common_checks.check_policy_json, {'conf': CONF})),
)
def _check_db_indexes(self): def _check_db_indexes(self):
"""Check if indexes exist on heavily used columns. """Check if indexes exist on heavily used columns.
@ -100,6 +85,22 @@ class Checks(upgradecheck.UpgradeCommands):
else: else:
return upgradecheck.Result(upgradecheck.Code.SUCCESS) return upgradecheck.Result(upgradecheck.Code.SUCCESS)
# A tuple of check tuples of (<name of check>, <check function>).
# The name of the check will be used in the output of this command.
# The check function takes no arguments and returns an
# oslo_upgradecheck.upgradecheck.Result object with the appropriate
# oslo_upgradecheck.upgradecheck.Code and details set. If the
# check function 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 = (
(_('Object versions'), _check_obj_versions),
(_('Database Index Status'), _check_db_indexes),
# Victoria -> Wallaby migration
(_('Policy File JSON to YAML Migration'),
(common_checks.check_policy_json, {'conf': CONF})),
)
def main(): def main():
return upgradecheck.main( return upgradecheck.main(