summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/compute/manager.py3
-rw-r--r--nova/conductor/api.py13
-rw-r--r--nova/conductor/manager.py9
-rw-r--r--nova/conductor/rpcapi.py9
-rw-r--r--nova/tests/conductor/test_conductor.py11
5 files changed, 43 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 588e437f9..f8b8d08e3 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -2876,7 +2876,8 @@ class ComputeManager(manager.SchedulerDependentManager):
@manager.periodic_task
def _poll_unconfirmed_resizes(self, context):
if CONF.resize_confirm_window > 0:
- migrations = self.db.migration_get_unconfirmed_by_dest_compute(
+ capi = self.conductor_api
+ migrations = capi.migration_get_unconfirmed_by_dest_compute(
context, CONF.resize_confirm_window, self.host)
migrations_info = dict(migration_count=len(migrations),
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 883b368df..ffcf5c8eb 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -110,6 +110,12 @@ class LocalAPI(object):
def migration_get(self, context, migration_id):
return self._manager.migration_get(context, migration_id)
+ def migration_get_unconfirmed_by_dest_compute(self, context,
+ confirm_window,
+ dest_compute):
+ return self._manager.migration_get_unconfirmed_by_dest_compute(
+ context, confirm_window, dest_compute)
+
def migration_update(self, context, migration, status):
return self._manager.migration_update(context, migration, status)
@@ -263,6 +269,13 @@ class API(object):
def migration_get(self, context, migration_id):
return self.conductor_rpcapi.migration_get(context, migration_id)
+ def migration_get_unconfirmed_by_dest_compute(self, context,
+ confirm_window,
+ dest_compute):
+ crpcapi = self.conductor_rpcapi
+ return crpcapi.migration_get_unconfirmed_by_dest_compute(
+ context, confirm_window, dest_compute)
+
def migration_update(self, context, migration, status):
return self.conductor_rpcapi.migration_update(context, migration,
status)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 1585a6e83..e2e2cfc77 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -43,7 +43,7 @@ datetime_fields = ['launched_at', 'terminated_at']
class ConductorManager(manager.SchedulerDependentManager):
"""Mission: TBD"""
- RPC_API_VERSION = '1.19'
+ RPC_API_VERSION = '1.20'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -83,6 +83,13 @@ class ConductorManager(manager.SchedulerDependentManager):
migration_id)
return jsonutils.to_primitive(migration_ref)
+ def migration_get_unconfirmed_by_dest_compute(self, context,
+ confirm_window,
+ dest_compute):
+ migrations = self.db.migration_get_unconfirmed_by_dest_compute(
+ context, confirm_window, dest_compute)
+ return jsonutils.to_primitive(migrations)
+
@rpc_common.client_exceptions(exception.MigrationNotFound)
def migration_update(self, context, migration, status):
migration_ref = self.db.migration_update(context.elevated(),
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 21ee59d31..9b3a802ea 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -51,6 +51,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.17 - Added instance_info_cache_delete
1.18 - Added instance_type_get
1.19 - Added vol_get_usage_by_time and vol_usage_update
+ 1.20 - Added migration_get_unconfirmed_by_dest_compute
"""
BASE_RPC_API_VERSION = '1.0'
@@ -76,6 +77,14 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
msg = self.make_msg('migration_get', migration_id=migration_id)
return self.call(context, msg, version='1.4')
+ def migration_get_unconfirmed_by_dest_compute(self, context,
+ confirm_window,
+ dest_compute):
+ msg = self.make_msg('migration_get_unconfirmed_by_dest_compute',
+ confirm_window=confirm_window,
+ dest_compute=dest_compute)
+ return self.call(context, msg, version='1.20')
+
def migration_update(self, context, migration, status):
migration_p = jsonutils.to_primitive(migration)
msg = self.make_msg('migration_update', migration=migration_p,
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index d2c3df19a..b2342f5b4 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -100,6 +100,17 @@ class _BaseTestCase(object):
self.conductor.migration_get(self.context,
migration['id']))
+ def test_migration_get_unconfirmed_by_dest_compute(self):
+ self.mox.StubOutWithMock(db,
+ 'migration_get_unconfirmed_by_dest_compute')
+ db.migration_get_unconfirmed_by_dest_compute(self.context,
+ 'fake-window',
+ 'fake-host')
+ self.mox.ReplayAll()
+ self.conductor.migration_get_unconfirmed_by_dest_compute(self.context,
+ 'fake-window',
+ 'fake-host')
+
def test_migration_update(self):
migration = db.migration_create(self.context.elevated(),
{'instance_uuid': 'fake-uuid',