summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiago Mello <tmello@linux.vnet.ibm.com>2013-01-22 19:01:10 -0200
committerTiago Mello <tmello@linux.vnet.ibm.com>2013-01-22 19:05:41 -0200
commitd442815d9909904a512258b0ec33d3a7a4ff0e31 (patch)
tree743845c29e1e91182cd52db7feafaaedbd463bcc
parent723987a16f093c18bb2d01f26f82d1ad1512c188 (diff)
downloadnova-d442815d9909904a512258b0ec33d3a7a4ff0e31.tar.gz
nova-d442815d9909904a512258b0ec33d3a7a4ff0e31.tar.xz
nova-d442815d9909904a512258b0ec33d3a7a4ff0e31.zip
Adds conductor support for instance_get_active_by_window_joined
This patch fixes Bug 1102469. Related to bp/no-db-compute-manager Change-Id: Ib9e7a4c380eb5d1a0c7059ad6a90d0aec1638fbd
-rw-r--r--nova/conductor/api.py10
-rw-r--r--nova/conductor/manager.py14
-rw-r--r--nova/conductor/rpcapi.py8
-rw-r--r--nova/tests/conductor/test_conductor.py15
4 files changed, 39 insertions, 8 deletions
diff --git a/nova/conductor/api.py b/nova/conductor/api.py
index 138e72f70..d05c94877 100644
--- a/nova/conductor/api.py
+++ b/nova/conductor/api.py
@@ -117,6 +117,11 @@ class LocalAPI(object):
return self._manager.instance_get_active_by_window(
context, begin, end, project_id, host)
+ def instance_get_active_by_window_joined(self, context, begin, end=None,
+ project_id=None, host=None):
+ return self._manager.instance_get_active_by_window_joined(
+ context, begin, end, project_id, host)
+
def instance_info_cache_update(self, context, instance, values):
return self._manager.instance_info_cache_update(context,
instance,
@@ -369,6 +374,11 @@ class API(object):
return self.conductor_rpcapi.instance_get_active_by_window(
context, begin, end, project_id, host)
+ def instance_get_active_by_window_joined(self, context, begin, end=None,
+ project_id=None, host=None):
+ return self.conductor_rpcapi.instance_get_active_by_window_joined(
+ context, begin, end, project_id, host)
+
def instance_info_cache_update(self, context, instance, values):
return self.conductor_rpcapi.instance_info_cache_update(context,
instance, values)
diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py
index 0ff2e1400..87b143912 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.34'
+ RPC_API_VERSION = '1.35'
def __init__(self, *args, **kwargs):
super(ConductorManager, self).__init__(service_name='conductor',
@@ -234,10 +234,14 @@ class ConductorManager(manager.SchedulerDependentManager):
def instance_get_active_by_window(self, context, begin, end=None,
project_id=None, host=None):
- result = self.db.instance_get_active_by_window_joined(context,
- begin, end,
- project_id,
- host)
+ result = self.db.instance_get_active_by_window(context, begin, end,
+ project_id, host)
+ return jsonutils.to_primitive(result)
+
+ def instance_get_active_by_window_joined(self, context, begin, end=None,
+ project_id=None, host=None):
+ result = self.db.instance_get_active_by_window_joined(
+ context, begin, end, project_id, host)
return jsonutils.to_primitive(result)
def instance_destroy(self, context, instance):
diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py
index 6dc8aef04..1699c85ed 100644
--- a/nova/conductor/rpcapi.py
+++ b/nova/conductor/rpcapi.py
@@ -67,6 +67,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.32 - Added optional node to instance_get_all_by_host
1.33 - Added compute_node_create and compute_node_update
1.34 - Added service_update
+ 1.35 - Added instance_get_active_by_window_joined
"""
BASE_RPC_API_VERSION = '1.0'
@@ -241,6 +242,13 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
host=host)
return self.call(context, msg, version='1.15')
+ def instance_get_active_by_window_joined(self, context, begin, end=None,
+ project_id=None, host=None):
+ msg = self.make_msg('instance_get_active_by_window_joined',
+ begin=begin, end=end, project_id=project_id,
+ host=host)
+ return self.call(context, msg, version='1.35')
+
def instance_destroy(self, context, instance):
instance_p = jsonutils.to_primitive(instance)
msg = self.make_msg('instance_destroy', instance=instance_p)
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index d010b454f..30d176bbd 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -335,14 +335,23 @@ class _BaseTestCase(object):
def test_instance_get_active_by_window(self):
self.mox.StubOutWithMock(db, 'instance_get_active_by_window_joined')
- db.instance_get_active_by_window_joined(self.context, 'fake-begin',
- 'fake-end', 'fake-proj',
- 'fake-host')
+ db.instance_get_active_by_window(self.context, 'fake-begin',
+ 'fake-end', 'fake-proj',
+ 'fake-host')
self.mox.ReplayAll()
self.conductor.instance_get_active_by_window(self.context,
'fake-begin', 'fake-end',
'fake-proj', 'fake-host')
+ def test_instance_get_active_by_window_joined(self):
+ self.mox.StubOutWithMock(db, 'instance_get_active_by_window_joined')
+ db.instance_get_active_by_window_joined(self.context, 'fake-begin',
+ 'fake-end', 'fake-proj',
+ 'fake-host')
+ self.mox.ReplayAll()
+ self.conductor.instance_get_active_by_window_joined(
+ self.context, 'fake-begin', 'fake-end', 'fake-proj', 'fake-host')
+
def test_instance_destroy(self):
self.mox.StubOutWithMock(db, 'instance_destroy')
db.instance_destroy(self.context, 'fake-uuid')