summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-05 00:32:02 +0000
committerGerrit Code Review <review@openstack.org>2013-01-05 00:32:02 +0000
commitc064fcbe84048fb839f7f541d8fdd05428e75617 (patch)
tree549323d44ea49d3eac4ec41908fd6d40d19c7c3d
parentb0fdc223a8a3aa85e0fc4f332b1477d9c488b0b7 (diff)
parentc740d3f270e221f712bbf8c1cc3ac4dcb8156c23 (diff)
downloadnova-c064fcbe84048fb839f7f541d8fdd05428e75617.tar.gz
nova-c064fcbe84048fb839f7f541d8fdd05428e75617.tar.xz
nova-c064fcbe84048fb839f7f541d8fdd05428e75617.zip
Merge "Move instance_type_get() to conductor"
-rw-r--r--nova/compute/manager.py2
-rw-r--r--nova/conductor/api.py7
-rw-r--r--nova/conductor/manager.py6
-rw-r--r--nova/conductor/rpcapi.py6
-rw-r--r--nova/tests/conductor/test_conductor.py7
5 files changed, 26 insertions, 2 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index a9bd866d3..953342924 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -1904,7 +1904,7 @@ class ComputeManager(manager.SchedulerDependentManager):
with self._error_out_instance_on_exception(context, instance['uuid'],
reservations):
if not instance_type:
- instance_type = self.db.instance_type_get(context,
+ instance_type = self.conductor_api.instance_type_get(context,
migration['new_instance_type_id'])
network_info = self._get_instance_nw_info(context, instance)
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 4f954a02d..ca65e83db 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -104,6 +104,9 @@ class LocalAPI(object):
def instance_info_cache_delete(self, context, instance):
return self._manager.instance_info_cache_delete(context, instance)
+ def instance_type_get(self, context, instance_type_id):
+ return self._manager.instance_type_get(context, instance_type_id)
+
def migration_get(self, context, migration_id):
return self._manager.migration_get(context, migration_id)
@@ -241,6 +244,10 @@ class API(object):
return self.conductor_rpcapi.instance_info_cache_delete(context,
instance)
+ def instance_type_get(self, context, instance_type_id):
+ return self.conductor_rpcapi.instance_type_get(context,
+ instance_type_id)
+
def migration_get(self, context, migration_id):
return self.conductor_rpcapi.migration_get(context, migration_id)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 1a9736a6b..7ddfd497e 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.17'
+ RPC_API_VERSION = '1.18'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -211,3 +211,7 @@ class ConductorManager(manager.SchedulerDependentManager):
def instance_info_cache_delete(self, context, instance):
self.db.instance_info_cache_delete(context, instance['uuid'])
+
+ def instance_type_get(self, context, instance_type_id):
+ result = self.db.instance_type_get(context, instance_type_id)
+ return jsonutils.to_primitive(result)
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 1279cdcf0..aeaad8868 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -49,6 +49,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
Deprecated instance_get_all_by_host
1.16 - Added instance_destroy
1.17 - Added instance_info_cache_delete
+ 1.18 - Added instance_type_get
"""
BASE_RPC_API_VERSION = '1.0'
@@ -202,3 +203,8 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
instance_p = jsonutils.to_primitive(instance)
msg = self.make_msg('instance_info_cache_delete', instance=instance_p)
self.call(context, msg, version='1.17')
+
+ def instance_type_get(self, context, instance_type_id):
+ msg = self.make_msg('instance_type_get',
+ instance_type_id=instance_type_id)
+ return self.call(context, msg, version='1.18')
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index 2cfbe904f..454d5347a 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -301,6 +301,13 @@ class _BaseTestCase(object):
self.conductor.instance_info_cache_delete(self.context,
{'uuid': 'fake-uuid'})
+ def test_instance_type_get(self):
+ self.mox.StubOutWithMock(db, 'instance_type_get')
+ db.instance_type_get(self.context, 'fake-id').AndReturn('fake-type')
+ self.mox.ReplayAll()
+ result = self.conductor.instance_type_get(self.context, 'fake-id')
+ self.assertEqual(result, 'fake-type')
+
class ConductorTestCase(_BaseTestCase, test.TestCase):
"""Conductor Manager Tests"""