summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2013-02-22 13:19:42 -0500
committerRussell Bryant <rbryant@redhat.com>2013-02-22 16:59:13 -0500
commitf4f6464f58482fe0c1193cadddb2db56dc4a2434 (patch)
treefc5981be4e43065910757b78c56d058cd00e9039
parentbdb73e20585e330a0d81bdbbb197d038c2601967 (diff)
Ensure macs can be serialized.
This patch uses to_primitive() to ensure that the macs argument to the rpcapi method allocate_for_instance() can be serialized by rpc drivers. Specifically, the powervm driver uses a set() here, and that will cause breakage in non-kombu drivers. Fix bug 1131035. Change-Id: I5729c5854799e49c6598e4dd2a4da487598307f1
-rw-r--r--nova/network/rpcapi.py3
-rw-r--r--nova/tests/network/test_rpcapi.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/nova/network/rpcapi.py b/nova/network/rpcapi.py
index d0d6b5f99..82263f85f 100644
--- a/nova/network/rpcapi.py
+++ b/nova/network/rpcapi.py
@@ -166,7 +166,8 @@ class NetworkAPI(rpc_proxy.RpcProxy):
return self.call(ctxt, self.make_msg('allocate_for_instance',
instance_id=instance_id, project_id=project_id, host=host,
rxtx_factor=rxtx_factor, vpn=vpn,
- requested_networks=requested_networks, macs=macs),
+ requested_networks=requested_networks,
+ macs=jsonutils.to_primitive(macs)),
topic=topic, version='1.9')
def deallocate_for_instance(self, ctxt, instance_id, project_id, host):
diff --git a/nova/tests/network/test_rpcapi.py b/nova/tests/network/test_rpcapi.py
index a161fe5e0..55d502915 100644
--- a/nova/tests/network/test_rpcapi.py
+++ b/nova/tests/network/test_rpcapi.py
@@ -181,7 +181,7 @@ class NetworkRpcAPITestCase(test.TestCase):
self._test_network_api('allocate_for_instance', rpc_method='call',
instance_id='fake_id', project_id='fake_id', host='fake_host',
rxtx_factor='fake_factor', vpn=False, requested_networks={},
- macs=set(), version='1.9')
+ macs=[], version='1.9')
def test_deallocate_for_instance(self):
self._test_network_api('deallocate_for_instance', rpc_method='call',