summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/conductor/api.py8
-rw-r--r--nova/conductor/manager.py6
-rw-r--r--nova/conductor/rpcapi.py10
-rw-r--r--nova/tests/conductor/test_conductor.py5
-rw-r--r--nova/tests/test_imagecache.py2
5 files changed, 21 insertions, 10 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 66badb756..8919b422f 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -82,10 +82,10 @@ class LocalAPI(object):
return self._manager.instance_destroy(context, instance)
def instance_get_all(self, context):
- return self.instance_get_all_by_filters(context, {})
+ return self._manager.instance_get_all(context)
def instance_get_all_by_host(self, context, host):
- return self.instance_get_all_by_filters(context, {'host': host})
+ return self._manager.instance_get_all_by_host(context, host)
def instance_get_all_by_filters(self, context, filters,
sort_key='created_at',
@@ -257,10 +257,10 @@ class API(object):
instance_uuid)
def instance_get_all(self, context):
- return self.instance_get_all_by_filters(context, {})
+ return self.conductor_rpcapi.instance_get_all(context)
def instance_get_all_by_host(self, context, host):
- return self.instance_get_all_by_filters(context, {'host': host})
+ return self.conductor_rpcapi.instance_get_all_by_host(context, host)
def instance_get_all_by_filters(self, context, filters,
sort_key='created_at',
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 123e7e13f..351860cf9 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.22'
+ RPC_API_VERSION = '1.23'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -75,7 +75,9 @@ class ConductorManager(manager.SchedulerDependentManager):
return jsonutils.to_primitive(
self.db.instance_get_by_uuid(context, instance_uuid))
- # NOTE(danms): This should go away in RPC version 2
+ def instance_get_all(self, context):
+ return jsonutils.to_primitive(self.db.instance_get_all(context))
+
def instance_get_all_by_host(self, context, host):
return jsonutils.to_primitive(
self.db.instance_get_all_by_host(context.elevated(), host))
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 0f2fe1f0c..97440adcb 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -54,6 +54,8 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.20 - Added migration_get_unconfirmed_by_dest_compute
1.21 - Added service_get_all_by
1.22 - Added ping
+ 1.23 - Added instance_get_all
+ Un-Deprecate instance_get_all_by_host
"""
BASE_RPC_API_VERSION = '1.0'
@@ -245,3 +247,11 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
def service_get_all_by(self, context, topic=None, host=None):
msg = self.make_msg('service_get_all_by', topic=topic, host=host)
return self.call(context, msg, version='1.21')
+
+ def instance_get_all(self, context):
+ msg = self.make_msg('instance_get_all')
+ return self.call(context, msg, version='1.23')
+
+ def instance_get_all_by_host(self, context, host):
+ msg = self.make_msg('instance_get_all_by_host', host=host)
+ return self.call(context, msg, version='1.23')
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index 86f47a79c..dcbafec9e 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -594,9 +594,8 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
def test_instance_get_all(self):
self.mox.StubOutWithMock(db, 'instance_get_all_by_filters')
- db.instance_get_all_by_filters(self.context, {}, 'created_at', 'desc')
- db.instance_get_all_by_filters(self.context, {'host': 'fake-host'},
- 'created_at', 'desc')
+ db.instance_get_all(self.context)
+ db.instance_get_all_by_host(self.context.elevated(), 'fake-host')
db.instance_get_all_by_filters(self.context, {'name': 'fake-inst'},
'updated_at', 'asc')
self.mox.ReplayAll()
diff --git a/nova/tests/test_imagecache.py b/nova/tests/test_imagecache.py
index affab4e29..f6c4f141f 100644
--- a/nova/tests/test_imagecache.py
+++ b/nova/tests/test_imagecache.py
@@ -947,7 +947,7 @@ class ImageCacheManagerTestCase(test.TestCase):
with utils.tempdir() as tmpdir:
self.flags(instances_path=tmpdir)
- self.stubs.Set(db, 'instance_get_all_by_filters', fake_get_all)
+ self.stubs.Set(db, 'instance_get_all', fake_get_all)
compute = importutils.import_object(CONF.compute_manager)
self.flags(use_local=True, group='conductor')
compute.conductor_api = conductor.API()