Add simple db purge command

This adds a simple purge command to nova-manage. It either deletes all
shadow archived data, or data older than a date if provided.

This also adds a post-test hook to run purge after archive to validate
that it at least works on data generated by a gate run.

Related to blueprint purge-db

Change-Id: I6f87cf03d49be6bfad2c5e6f0c8accf0fab4e6ee
This commit is contained in:
Dan Smith
2018-03-06 09:10:27 -08:00
parent 64635ba18d
commit ae241cc68f
8 changed files with 238 additions and 0 deletions
+12
View File
@@ -18,6 +18,17 @@ function archive_deleted_rows {
done
}
function purge_db {
$MANAGE $* db purge --all --verbose
RET=$?
if [[ $RET -eq 0 ]]; then
echo Purge successful
else
echo Purge failed with result $RET
return $RET
fi
}
BASE=${BASE:-/opt/stack}
source ${BASE}/new/devstack/functions-common
source ${BASE}/new/devstack/lib/nova
@@ -29,6 +40,7 @@ cell_conf=$(conductor_conf 1)
conf="--config-file $NOVA_CONF --config-file $cell_conf"
archive_deleted_rows $conf
purge_db $conf
set -e
# We need to get the admin credentials to run the OSC CLIs for Placement.