Make nova-manage db archive_deleted_rows more explicit

* max_rows must be positive
    Provide a better error message of 'nova-manage db archive_deleted_rows
    --max_rows=' is negative.
* Requires a max_rows
* No hidden default of 5000

Fix bug 1145609
Fix bug 1151064

Change-Id: I9078ff2700a0329ac4aff68bb434be5f16a5a3f1
This commit is contained in:
Joe Gordon
2013-03-05 01:11:45 +00:00
parent dd5c6ac3bd
commit 0fd4343da9

View File

@@ -790,12 +790,15 @@ class DbCommands(object):
@args('--max_rows', dest='max_rows', metavar='<number>',
help='Maximum number of deleted rows to archive')
def archive_deleted_rows(self, max_rows=None):
def archive_deleted_rows(self, max_rows):
"""Move up to max_rows deleted rows from production tables to shadow
tables.
"""
if max_rows is not None:
max_rows = int(max_rows)
if max_rows < 0:
print _("Must supply a positive value for max_rows")
sys.exit(1)
admin_context = context.get_admin_context()
db.archive_deleted_rows(admin_context, max_rows)