From 63c59b877513a02ee94e29978314971734148de0 Mon Sep 17 00:00:00 2001 From: Mandar Vaze Date: 2012年4月10日 05:05:17 -0700 Subject: [PATCH] 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 --- Authors | 1 + nova/db/sqlalchemy/api.py | 2 +- nova/tests/test_db_api.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Authors b/Authors index 8045d41f60f7..0fcb1fdf058d 100644 --- a/Authors +++ b/Authors @@ -124,6 +124,7 @@ Loganathan Parthipan Lorin Hochstein Lvov Maxim Mandell Degerness +Mandar Vaze Mark McClain Mark McLoughlin Mark Washenberger diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 0f1aaa80b446..49d3df0f98fc 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -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() diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index d54fcda81544..b7b9531c3b7b 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -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))

AltStyle によって変換されたページ (->オリジナル) /