summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/cert/rpcapi.py7
-rw-r--r--nova/compute/rpcapi.py17
-rw-r--r--nova/console/rpcapi.py7
-rw-r--r--nova/consoleauth/rpcapi.py7
-rw-r--r--nova/scheduler/rpcapi.py4
-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
12 files changed, 57 insertions, 45 deletions
diff --git a/nova/cert/rpcapi.py b/nova/cert/rpcapi.py
index cbf1af61f..7922c9c33 100644
--- a/nova/cert/rpcapi.py
+++ b/nova/cert/rpcapi.py
@@ -33,11 +33,12 @@ class CertAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.0 - Initial version.
'''
- RPC_API_VERSION = '1.0'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self):
- super(CertAPI, self).__init__(topic=FLAGS.cert_topic,
- default_version=self.RPC_API_VERSION)
+ super(CertAPI, self).__init__(
+ topic=FLAGS.cert_topic,
+ default_version=self.BASE_RPC_API_VERSION)
def revoke_certs_by_user(self, ctxt, user_id):
return self.call(ctxt, self.make_msg('revoke_certs_by_user',
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 116b2d34b..d740925a7 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -57,11 +57,12 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.1 - Adds get_host_uptime()
'''
- RPC_API_VERSION = '1.1'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self):
- super(ComputeAPI, self).__init__(topic=FLAGS.compute_topic,
- default_version=self.RPC_API_VERSION)
+ super(ComputeAPI, self).__init__(
+ topic=FLAGS.compute_topic,
+ default_version=self.BASE_RPC_API_VERSION)
def add_aggregate_host(self, ctxt, aggregate_id, host_param, host):
'''Add aggregate host.
@@ -316,7 +317,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
def get_host_uptime(self, ctxt, host):
topic = _compute_topic(self.topic, ctxt, host, None)
- return self.call(ctxt, self.make_msg('get_host_uptime'), topic)
+ return self.call(ctxt, self.make_msg('get_host_uptime'), topic,
+ version='1.1')
def snapshot_instance(self, ctxt, instance, image_id, image_type,
backup_type, rotation):
@@ -371,11 +373,12 @@ class SecurityGroupAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.0 - Initial version.
'''
- RPC_API_VERSION = '1.0'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self):
- super(SecurityGroupAPI, self).__init__(topic=FLAGS.compute_topic,
- default_version=self.RPC_API_VERSION)
+ super(SecurityGroupAPI, self).__init__(
+ topic=FLAGS.compute_topic,
+ default_version=self.BASE_RPC_API_VERSION)
def refresh_security_group_rules(self, ctxt, security_group_id, host):
self.cast(ctxt, self.make_msg('refresh_security_group_rules',
diff --git a/nova/console/rpcapi.py b/nova/console/rpcapi.py
index 66c963403..6a5e2149b 100644
--- a/nova/console/rpcapi.py
+++ b/nova/console/rpcapi.py
@@ -33,12 +33,13 @@ class ConsoleAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.0 - Initial version.
'''
- RPC_API_VERSION = '1.0'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self, topic=None):
topic = topic if topic else FLAGS.console_topic
- super(ConsoleAPI, self).__init__(topic=topic,
- default_version=self.RPC_API_VERSION)
+ super(ConsoleAPI, self).__init__(
+ topic=topic,
+ default_version=self.BASE_RPC_API_VERSION)
def add_console(self, ctxt, instance_id):
self.cast(ctxt, self.make_msg('add_console', instance_id=instance_id))
diff --git a/nova/consoleauth/rpcapi.py b/nova/consoleauth/rpcapi.py
index c6a02e949..573387f48 100644
--- a/nova/consoleauth/rpcapi.py
+++ b/nova/consoleauth/rpcapi.py
@@ -33,11 +33,12 @@ class ConsoleAuthAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.0 - Initial version.
'''
- RPC_API_VERSION = '1.0'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self):
- super(ConsoleAuthAPI, self).__init__(topic=FLAGS.consoleauth_topic,
- default_version=self.RPC_API_VERSION)
+ super(ConsoleAuthAPI, self).__init__(
+ topic=FLAGS.consoleauth_topic,
+ default_version=self.BASE_RPC_API_VERSION)
def authorize_console(self, ctxt, token, console_type, host, port,
internal_access_path):
diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py
index dea17b912..cdd3e6480 100644
--- a/nova/scheduler/rpcapi.py
+++ b/nova/scheduler/rpcapi.py
@@ -33,11 +33,11 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.0 - Initial version.
'''
- RPC_API_VERSION = '1.0'
+ BASE_RPC_API_VERSION = '1.0'
def __init__(self):
super(SchedulerAPI, self).__init__(topic=FLAGS.scheduler_topic,
- default_version=self.RPC_API_VERSION)
+ default_version=self.BASE_RPC_API_VERSION)
def run_instance(self, ctxt, topic, request_spec, admin_password,
injected_files, requested_networks, is_first_time,
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,