migration_get_all_unconfirmed() now uses lowercase "finished" Fixes bug

977719

status set in _finish_resize is lower case, but
migration_get_all_unconfirmed() was filtering using FINISHED
Also updated corresponding test case to use lower case "finished"
Updated Authors file

Change-Id: Ia30e66e541bba91a9dd3d3af1429b2312870793a
This commit is contained in:
Mandar Vaze 2012-04-10 05:05:17 -07:00
parent 384b758166
commit 63c59b8775
3 changed files with 4 additions and 3 deletions

View File

@ -124,6 +124,7 @@ Loganathan Parthipan <parthipan@hp.com>
Lorin Hochstein <lorin@nimbisservices.com>
Lvov Maxim <usrleon@gmail.com>
Mandell Degerness <mdegerne@gmail.com>
Mandar Vaze <mandar.vaze@vertex.co.in>
Mark McClain <mark.mcclain@dreamhost.com>
Mark McLoughlin <markmc@redhat.com>
Mark Washenberger <mark.washenberger@rackspace.com>

View File

@ -3264,7 +3264,7 @@ def migration_get_all_unconfirmed(context, confirm_window, session=None):
return model_query(context, models.Migration, session=session,
read_deleted="yes").\
filter(models.Migration.updated_at <= confirm_window).\
filter_by(status="FINISHED").\
filter_by(status="finished").\
all()

View File

@ -89,7 +89,7 @@ class DbApiTestCase(test.TestCase):
# Ensure one migration older than 10 seconds is returned.
updated_at = datetime.datetime(2000, 01, 01, 12, 00, 00)
values = {"status": "FINISHED", "updated_at": updated_at}
values = {"status": "finished", "updated_at": updated_at}
migration = db.migration_create(ctxt, values)
results = db.migration_get_all_unconfirmed(ctxt, 10)
self.assertEqual(1, len(results))
@ -97,7 +97,7 @@ class DbApiTestCase(test.TestCase):
# Ensure the new migration is not returned.
updated_at = datetime.datetime.utcnow()
values = {"status": "FINISHED", "updated_at": updated_at}
values = {"status": "finished", "updated_at": updated_at}
migration = db.migration_create(ctxt, values)
results = db.migration_get_all_unconfirmed(ctxt, 10)
self.assertEqual(0, len(results))