summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-12 16:08:14 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-12 16:10:37 -0400
commitb0377bc6d6d88c3e1ec68195de87a3bab194be1c (patch)
tree03e72e56e9b993e23668ab4a2ccc82ba38c65dc6 /nova/tests
parent6d9a3e62b073f294330d57a12378c1f6e58bd970 (diff)
downloadnova-b0377bc6d6d88c3e1ec68195de87a3bab194be1c.tar.gz
nova-b0377bc6d6d88c3e1ec68195de87a3bab194be1c.tar.xz
nova-b0377bc6d6d88c3e1ec68195de87a3bab194be1c.zip
Change base rpc version to 1.0 in compute rpcapi.
A recent patch change the RPC_API_VERSION in compute/rpcapi.py to 1.1. This change was the right thing to do in compute/manager.py, but not compute/rpcapi.py. This patch changes it back to 1.0, and changes the code to only specify that 1.1 is required for the new method. This version in the rpcapi modules is used as the default version to set in a message. The version sent in a message is the minimum version required to be implemented on the manager side for the message to be successfully processed. For most messages, that is just 1.0. In the case of the new method, it's 1.1. This patch also changes the name of his variable in the rpcapi modules from RPC_API_VERSION to BASE_RPC_API_VERSION to help clarify this a bit more. Change-Id: I2bb4602845869bd44b39531eeb4f1e7c0c4c20c2
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/cert/test_rpcapi.py2
-rw-r--r--nova/tests/compute/test_compute.py24
-rw-r--r--nova/tests/compute/test_rpcapi.py6
-rw-r--r--nova/tests/console/test_rpcapi.py2
-rw-r--r--nova/tests/consoleauth/test_rpcapi.py2
-rw-r--r--nova/tests/scheduler/test_rpcapi.py2
-rw-r--r--nova/tests/scheduler/test_scheduler.py22
7 files changed, 33 insertions, 27 deletions
diff --git a/nova/tests/cert/test_rpcapi.py b/nova/tests/cert/test_rpcapi.py
index 1deb82c98..a7c951f6c 100644
--- a/nova/tests/cert/test_rpcapi.py
+++ b/nova/tests/cert/test_rpcapi.py
@@ -41,7 +41,7 @@ class CertRpcAPITestCase(test.TestCase):
rpcapi = cert_rpcapi.CertAPI()
expected_retval = 'foo'
expected_msg = rpcapi.make_msg(method, **kwargs)
- expected_msg['version'] = rpcapi.RPC_API_VERSION
+ expected_msg['version'] = rpcapi.BASE_RPC_API_VERSION
self.call_ctxt = None
self.call_topic = None
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py
index bbf000836..feaae8d53 100644
--- a/nova/tests/compute/test_compute.py
+++ b/nova/tests/compute/test_compute.py
@@ -1452,7 +1452,7 @@ class ComputeTestCase(BaseTestCase):
"args": {'instance_id': inst_ref['id'],
'block_migration': True,
'disk': None},
- "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION
+ "version": compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION
}, None).AndRaise(rpc.common.RemoteError('', '', ''))
# mocks for rollback
@@ -1464,7 +1464,8 @@ class ComputeTestCase(BaseTestCase):
{"method": "remove_volume_connection",
"args": {'instance_id': inst_ref['id'],
'volume_id': volume_id},
- "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None)
+ "version": compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None)
rpc.cast(c, topic, {"method": "rollback_live_migration_at_destination",
"args": {'instance_id': inst_ref['id']}})
@@ -1497,7 +1498,8 @@ class ComputeTestCase(BaseTestCase):
"args": {'instance_id': instance_id,
'block_migration': False,
'disk': None},
- "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None)
+ "version": compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None)
# start test
self.mox.ReplayAll()
@@ -1536,7 +1538,8 @@ class ComputeTestCase(BaseTestCase):
rpc.call(c, rpc.queue_get_for(c, FLAGS.compute_topic, dest),
{"method": "post_live_migration_at_destination",
"args": {'instance_id': i_ref['id'], 'block_migration': False},
- "version": compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None)
+ "version": compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None)
self.mox.StubOutWithMock(self.compute.driver, 'unplug_vifs')
self.compute.driver.unplug_vifs(i_ref, [])
rpc.call(c, 'network', {'method': 'setup_networks_on_host',
@@ -3514,7 +3517,7 @@ class ComputeAPITestCase(BaseTestCase):
rpc_msg1 = {'method': 'get_vnc_console',
'args': {'instance_uuid': fake_instance['uuid'],
'console_type': fake_console_type},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION}
rpc_msg2 = {'method': 'authorize_console',
'args': fake_connect_info,
'version': '1.0'}
@@ -3541,7 +3544,7 @@ class ComputeAPITestCase(BaseTestCase):
rpc_msg = {'method': 'get_console_output',
'args': {'instance_uuid': fake_instance['uuid'],
'tail_length': fake_tail_length},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION}
rpc.call(self.context, 'compute.%s' % fake_instance['host'],
rpc_msg, None).AndReturn(fake_console_output)
@@ -4055,7 +4058,7 @@ class ComputeHostAPITestCase(BaseTestCase):
self.assertEqual(call_info['msg'],
{'method': 'set_host_enabled',
'args': {'enabled': 'fake_enabled'},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION})
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION})
def test_get_host_uptime(self):
ctxt = context.RequestContext('fake', 'fake')
@@ -4068,7 +4071,7 @@ class ComputeHostAPITestCase(BaseTestCase):
self.assertEqual(call_info['msg'],
{'method': 'get_host_uptime',
'args': {},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION})
+ 'version': '1.1'})
def test_host_power_action(self):
ctxt = context.RequestContext('fake', 'fake')
@@ -4080,7 +4083,8 @@ class ComputeHostAPITestCase(BaseTestCase):
self.assertEqual(call_info['msg'],
{'method': 'host_power_action',
'args': {'action': 'fake_action'},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION})
+ 'version':
+ compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION})
def test_set_host_maintenance(self):
ctxt = context.RequestContext('fake', 'fake')
@@ -4092,7 +4096,7 @@ class ComputeHostAPITestCase(BaseTestCase):
self.assertEqual(call_info['msg'],
{'method': 'host_maintenance_mode',
'args': {'host': 'fake_host', 'mode': 'fake_mode'},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION})
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION})
class KeypairAPITestCase(BaseTestCase):
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index 4f606c7b5..fbaf3b4d7 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -52,6 +52,7 @@ class ComputeRpcAPITestCase(test.TestCase):
rpcapi = rpcapi_class()
expected_retval = 'foo' if method == 'call' else None
+ expected_version = kwargs.pop('version', rpcapi.BASE_RPC_API_VERSION)
expected_msg = rpcapi.make_msg(method, **kwargs)
if 'host_param' in expected_msg['args']:
host_param = expected_msg['args']['host_param']
@@ -70,7 +71,7 @@ class ComputeRpcAPITestCase(test.TestCase):
expected_msg['args']['instance_name'] = instance['name']
else:
expected_msg['args']['instance_uuid'] = instance['uuid']
- expected_msg['version'] = rpcapi.RPC_API_VERSION
+ expected_msg['version'] = expected_version
cast_and_call = ['confirm_resize', 'stop_instance']
if rpc_method == 'call' and method in cast_and_call:
@@ -282,7 +283,8 @@ class ComputeRpcAPITestCase(test.TestCase):
enabled='enabled', host='host')
def test_get_host_uptime(self):
- self._test_compute_api('get_host_uptime', 'call', host='host')
+ self._test_compute_api('get_host_uptime', 'call', host='host',
+ version='1.1')
def test_snapshot_instance(self):
self._test_compute_api('snapshot_instance', 'cast',
diff --git a/nova/tests/console/test_rpcapi.py b/nova/tests/console/test_rpcapi.py
index 016451928..f1150a079 100644
--- a/nova/tests/console/test_rpcapi.py
+++ b/nova/tests/console/test_rpcapi.py
@@ -40,7 +40,7 @@ class ConsoleRpcAPITestCase(test.TestCase):
ctxt = context.RequestContext('fake_user', 'fake_project')
rpcapi = console_rpcapi.ConsoleAPI()
expected_msg = rpcapi.make_msg(method, **kwargs)
- expected_msg['version'] = rpcapi.RPC_API_VERSION
+ expected_msg['version'] = rpcapi.BASE_RPC_API_VERSION
self.cast_ctxt = None
self.cast_topic = None
diff --git a/nova/tests/consoleauth/test_rpcapi.py b/nova/tests/consoleauth/test_rpcapi.py
index 91626c765..10484c7d9 100644
--- a/nova/tests/consoleauth/test_rpcapi.py
+++ b/nova/tests/consoleauth/test_rpcapi.py
@@ -41,7 +41,7 @@ class ConsoleAuthRpcAPITestCase(test.TestCase):
rpcapi = consoleauth_rpcapi.ConsoleAuthAPI()
expected_retval = 'foo'
expected_msg = rpcapi.make_msg(method, **kwargs)
- expected_msg['version'] = rpcapi.RPC_API_VERSION
+ expected_msg['version'] = rpcapi.BASE_RPC_API_VERSION
self.call_ctxt = None
self.call_topic = None
diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py
index fed367c70..cfd16a08b 100644
--- a/nova/tests/scheduler/test_rpcapi.py
+++ b/nova/tests/scheduler/test_rpcapi.py
@@ -41,7 +41,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
rpcapi = scheduler_rpcapi.SchedulerAPI()
expected_retval = 'foo' if method == 'call' else None
expected_msg = rpcapi.make_msg(method, **kwargs)
- expected_msg['version'] = rpcapi.RPC_API_VERSION
+ expected_msg['version'] = rpcapi.BASE_RPC_API_VERSION
if rpc_method == 'cast' and method == 'run_instance':
kwargs['call'] = False
diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py
index 5d1d6c8e9..61d089b3b 100644
--- a/nova/tests/scheduler/test_scheduler.py
+++ b/nova/tests/scheduler/test_scheduler.py
@@ -476,21 +476,21 @@ class SchedulerTestCase(test.TestCase):
rpc.call(self.context, 'dest_queue',
{'method': 'create_shared_storage_test_file',
'args': {},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None
- ).AndReturn(tmp_filename)
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None).AndReturn(tmp_filename)
rpc.queue_get_for(self.context, FLAGS.compute_topic,
instance['host']).AndReturn('src_queue')
rpc.call(self.context, 'src_queue',
{'method': 'check_shared_storage_test_file',
'args': {'filename': tmp_filename},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None
- ).AndReturn(check_result)
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None).AndReturn(check_result)
rpc.queue_get_for(self.context, FLAGS.compute_topic,
dest).AndReturn('dest_queue')
rpc.cast(self.context, 'dest_queue',
{'method': 'cleanup_shared_storage_test_file',
'args': {'filename': tmp_filename},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION})
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION})
def test_live_migration_all_checks_pass(self):
"""Test live migration when all checks pass."""
@@ -535,7 +535,7 @@ class SchedulerTestCase(test.TestCase):
'args': {
'instance_name': instance['name'],
},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION,
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION,
}
instance_disk_info = [{'disk_size': 1024 * (1024 ** 3)}]
rpc.call(self.context,
@@ -560,8 +560,8 @@ class SchedulerTestCase(test.TestCase):
rpc.call(self.context, 'dest_queue',
{'method': 'compare_cpu',
'args': {'cpu_info': 'fake_cpu_info'},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None
- ).AndReturn(True)
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None).AndReturn(True)
db.instance_update_and_get_original(self.context, instance['id'],
{"task_state": task_states.MIGRATING}).AndReturn(
@@ -746,7 +746,7 @@ class SchedulerTestCase(test.TestCase):
'args': {
'instance_name': instance['name'],
},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION,
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION,
}
instance_disk_info = [{'disk_size': 1024 * (1024 ** 3)}]
rpc.call(self.context,
@@ -926,8 +926,8 @@ class SchedulerTestCase(test.TestCase):
rpc.call(self.context, 'dest_queue',
{'method': 'compare_cpu',
'args': {'cpu_info': 'fake_cpu_info'},
- 'version': compute_rpcapi.ComputeAPI.RPC_API_VERSION}, None
- ).AndRaise(rpc_common.RemoteError())
+ 'version': compute_rpcapi.ComputeAPI.BASE_RPC_API_VERSION},
+ None).AndRaise(rpc_common.RemoteError())
self.mox.ReplayAll()
self.assertRaises(rpc_common.RemoteError,