From 5c837673d61880809ce83152b4010c86d036f77a Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 7 Mar 2018 07:08:14 -0800 Subject: [PATCH] Make nova-manage db purge take --all-cells This makes purge iterate over all cells if requested. This also makes our post_test_hook.sh use the --all-cells variant with just the base config file. Related to blueprint purge-db Change-Id: I7eb5ed05224838cdba18e96724162cc930f4422e --- gate/post_test_hook.sh | 4 ++-- nova/db/sqlalchemy/api.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gate/post_test_hook.sh b/gate/post_test_hook.sh index c56e15569..b27274b04 100755 --- a/gate/post_test_hook.sh +++ b/gate/post_test_hook.sh @@ -19,7 +19,7 @@ function archive_deleted_rows { } function purge_db { - $MANAGE $* db purge --all --verbose + $MANAGE db purge --all --verbose --all-cells RET=$? if [[ $RET -eq 0 ]]; then echo Purge successful @@ -40,7 +40,7 @@ cell_conf=$(conductor_conf 1) conf="--config-file $NOVA_CONF --config-file $cell_conf" archive_deleted_rows $conf -purge_db $conf +purge_db set -e # We need to get the admin credentials to run the OSC CLIs for Placement. diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 54b28013c..5c9388da8 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -5926,8 +5926,8 @@ def _purgeable_tables(metadata): t.name.endswith('migrate_version'))] -def purge_shadow_tables(before_date, status_fn=None): - engine = get_engine() +def purge_shadow_tables(context, before_date, status_fn=None): + engine = get_engine(context=context) conn = engine.connect() metadata = MetaData() metadata.bind = engine