From 8a3c7d30914c7cd1f85583316980ece3c33ed3d1 Mon Sep 17 00:00:00 2001 From: Brian Elliott Date: Tue, 27 Nov 2012 16:49:58 +0000 Subject: Make resize and multi-node work properly together Added node support to migrations and update node properly in 'resize_instance'. bug 1081355 Change-Id: I003d34e3f7ed9ce2feda19ee5ce210ed4ba7eaa1 --- nova/db/api.py | 8 ++++---- nova/db/sqlalchemy/api.py | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'nova/db') diff --git a/nova/db/api.py b/nova/db/api.py index 37acffaf0..d57e612c4 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -404,11 +404,11 @@ def migration_get_unconfirmed_by_dest_compute(context, confirm_window, confirm_window, dest_compute) -def migration_get_in_progress_by_host(context, host): - """Finds all migrations for the given host that are not yet confirmed or - reverted. +def migration_get_in_progress_by_host_and_node(context, host, node): + """Finds all migrations for the given host + node that are not yet + confirmed or reverted. """ - return IMPL.migration_get_in_progress_by_host(context, host) + return IMPL.migration_get_in_progress_by_host_and_node(context, host, node) #################### diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index e1d44b727..c19fc3202 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -3394,11 +3394,14 @@ def migration_get_unconfirmed_by_dest_compute(context, confirm_window, @require_admin_context -def migration_get_in_progress_by_host(context, host, session=None): +def migration_get_in_progress_by_host_and_node(context, host, node, + session=None): return model_query(context, models.Migration, session=session).\ - filter(or_(models.Migration.source_compute == host, - models.Migration.dest_compute == host)).\ + filter(or_(and_(models.Migration.source_compute == host, + models.Migration.source_node == node), + and_(models.Migration.dest_compute == host, + models.Migration.dest_node == node))).\ filter(~models.Migration.status.in_(['confirmed', 'reverted'])).\ options(joinedload('instance')).\ all() -- cgit