summaryrefslogtreecommitdiffstats
path: root/nova/conductor
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2012-12-07 09:00:04 -0800
committerDan Smith <danms@us.ibm.com>2012-12-07 09:00:04 -0800
commitaa97ba926d5bf6bc81903c5d651ece308e9629c0 (patch)
tree12ca5b0aa38a48c8c4c784e2dd6fd625282cbc13 /nova/conductor
parent3c45436cbfe45236e3e6643b80c061c618e3bfa1 (diff)
downloadnova-aa97ba926d5bf6bc81903c5d651ece308e9629c0.tar.gz
nova-aa97ba926d5bf6bc81903c5d651ece308e9629c0.tar.xz
nova-aa97ba926d5bf6bc81903c5d651ece308e9629c0.zip
Use conductor for migration_get()
This patch removes direct database accesses for looking up migrations by id, and instead queries conductor. Related to blueprint no-db-compute Change-Id: Ia7df121971b14b1eb4ce65063246968b3603309d
Diffstat (limited to 'nova/conductor')
-rw-r--r--nova/conductor/api.py6
-rw-r--r--nova/conductor/manager.py7
-rw-r--r--nova/conductor/rpcapi.py5
3 files changed, 17 insertions, 1 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index ddbd64d03..781a6ea90 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -53,6 +53,9 @@ class LocalAPI(object):
def instance_get_all_by_host(self, context, host):
return self._manager.instance_get_all_by_host(context, host)
+ def migration_get(self, context, migration_id):
+ return self._manager.migration_get(context, migration_id)
+
def migration_update(self, context, migration, status):
return self._manager.migration_update(context, migration, status)
@@ -81,6 +84,9 @@ class API(object):
def instance_get_all_by_host(self, context, host):
return self.conductor_rpcapi.instance_get_all_by_host(context, host)
+ def migration_get(self, context, migration_id):
+ return self.conductor_rpcapi.migration_get(context, migration_id)
+
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 824875b3c..ce76fe02d 100644
--- a/nova/conductor/manager.py
+++ b/nova/conductor/manager.py
@@ -41,7 +41,7 @@ datetime_fields = ['launched_at', 'terminated_at']
class ConductorManager(manager.SchedulerDependentManager):
"""Mission: TBD"""
- RPC_API_VERSION = '1.3'
+ RPC_API_VERSION = '1.4'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -69,6 +69,11 @@ class ConductorManager(manager.SchedulerDependentManager):
return jsonutils.to_primitive(
self.db.instance_get_all_by_host(context.elevated(), host))
+ def migration_get(self, context, migration_id):
+ migration_ref = self.db.migration_get(context.elevated(),
+ migration_id)
+ return jsonutils.to_primitive(migration_ref)
+
def migration_update(self, context, migration, status):
migration_ref = self.db.migration_update(context.elevated(),
migration['id'],
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index ae82856e4..0ca1269c4 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -30,6 +30,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.1 - Added migration_update
1.2 - Added instance_get_by_uuid and instance_get_all_by_host
1.3 - Added aggregate_host_add and aggregate_host_delete
+ 1.4 - Added migration_get
"""
BASE_RPC_API_VERSION = '1.0'
@@ -55,6 +56,10 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
msg = self.make_msg('instance_get_all_by_host', host=host)
return self.call(context, msg, version='1.2')
+ def migration_get(self, context, migration_id):
+ msg = self.make_msg('migration_get', migration_id=migration_id)
+ return self.call(context, msg, version='1.4')
+
def migration_update(self, context, migration, status):
migration_p = jsonutils.to_primitive(migration)
msg = self.make_msg('migration_update', migration=migration_p,