From 5a1236e469faf0f415989249d8aaa1c510fa8b3d Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 29 May 2012 22:00:10 -0400 Subject: Add compare_cpu to the compute rpcapi. Part of bug 1006467. This patch adds compare_cpu to the compute rpcapi. This is used by the scheduler. Change-Id: Ibce3ab3797c1305829c0722be1813e462193f08b --- nova/tests/compute/test_rpcapi.py | 4 ++++ nova/tests/scheduler/test_scheduler.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index 7a4fda426..23ac55fc3 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -105,6 +105,10 @@ class ComputeRpcAPITestCase(test.TestCase): self._test_compute_api('attach_volume', 'cast', instance=self.fake_instance, volume_id='id', mountpoint='mp') + def test_compare_cpu(self): + self._test_compute_api('compare_cpu', 'call', cpu_info='info', + host='host') + def test_confirm_resize_cast(self): self._test_compute_api('confirm_resize', 'cast', instance=self.fake_instance, migration_id='id', host='host') diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index 302f22939..e7057b406 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -23,6 +23,7 @@ import json from nova.compute import api as compute_api from nova.compute import power_state +from nova.compute import rpcapi as compute_rpcapi from nova.compute import vm_states from nova import context from nova import db @@ -539,7 +540,9 @@ class SchedulerTestCase(test.TestCase): dest).AndReturn('dest_queue') rpc.call(self.context, 'dest_queue', {'method': 'compare_cpu', - 'args': {'cpu_info': 'fake_cpu_info'}}).AndReturn(True) + 'args': {'cpu_info': 'fake_cpu_info'}, + 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None + ).AndReturn(True) db.instance_update_and_get_original(self.context, instance['id'], {"vm_state": vm_states.MIGRATING}).AndReturn( @@ -957,8 +960,9 @@ class SchedulerTestCase(test.TestCase): dest).AndReturn('dest_queue') rpc.call(self.context, 'dest_queue', {'method': 'compare_cpu', - 'args': {'cpu_info': 'fake_cpu_info'}}).AndRaise( - rpc_common.RemoteError()) + 'args': {'cpu_info': 'fake_cpu_info'}, + 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None + ).AndRaise(rpc_common.RemoteError()) self.mox.ReplayAll() self.assertRaises(rpc_common.RemoteError, -- cgit