Don't track migrations in 'accepted' state

This state was added during Liberty for evacuate, and since it's the
first state that is assigned to the migration record on it's creation,
and before we start using it for resource tracking, there is no reason
to consider those records as "in progress".

Change-Id: I2a9bbe87bc1518cee9e43e4eeec1fa585305f423
Related-bug: 1417667
This commit is contained in:
Nikola Dipanov 2015-10-16 17:18:56 +01:00
parent f73fe579a6
commit 2c1f8e6002
2 changed files with 4 additions and 2 deletions

View File

@ -4483,8 +4483,8 @@ def migration_get_in_progress_by_host_and_node(context, host, node):
models.Migration.source_node == node),
and_(models.Migration.dest_compute == host,
models.Migration.dest_node == node))).\
filter(~models.Migration.status.in_(['confirmed', 'reverted',
'error'])).\
filter(~models.Migration.status.in_(['accepted', 'confirmed',
'reverted', 'error'])).\
options(joinedload_all('instance.system_metadata')).\
all()

View File

@ -1309,6 +1309,7 @@ class MigrationTestCase(test.TestCase):
self._create(status='reverted')
self._create(status='confirmed')
self._create(status='error')
self._create(status='accepted')
self._create(source_compute='host2', source_node='b',
dest_compute='host1', dest_node='a')
self._create(source_compute='host2', dest_compute='host3')
@ -1335,6 +1336,7 @@ class MigrationTestCase(test.TestCase):
self.assertNotEqual('confirmed', migration['status'])
self.assertNotEqual('reverted', migration['status'])
self.assertNotEqual('error', migration['status'])
self.assertNotEqual('accepted', migration['status'])
def test_migration_get_in_progress_joins(self):
self._create(source_compute='foo', system_metadata={'foo': 'bar'})