]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ensure request_spec can be serialized.
authorRussell Bryant <rbryant@redhat.com>
Fri, 30 Nov 2012 14:19:05 +0000 (09:19 -0500)
committerRussell Bryant <rbryant@redhat.com>
Fri, 30 Nov 2012 14:19:05 +0000 (09:19 -0500)
request_spec includes some objects that must be converted to primitive
types to ensure they can be serialized by any of the rpc drivers.  In
this case, it's the volume type.  It's a sqlalchemy model.
to_primitive() will ensure that it gets converted to a dict so that it
can be serialized for messaging.

I saw this error in a smokestack log that was running tempest with qpid.
You won't see this error if you're using rabbit with the kombu driver.
We have some magic with the kombu driver that will fix these problems
automatically if they are missed.

Change-Id: I9a1b7662bca7caa2acb61d1e3879ac2654d5b32e

cinder/scheduler/rpcapi.py

index 93bdb6e3e195a417d796effb1852d1c91836a8c5..cadde6189f13487ff0c39b0fbaab3ab50feed1a8 100644 (file)
@@ -19,6 +19,7 @@ Client side of the scheduler manager RPC API.
 """
 
 from cinder import flags
+from cinder.openstack.common import jsonutils
 import cinder.openstack.common.rpc.proxy
 
 
@@ -46,13 +47,14 @@ class SchedulerAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
     def create_volume(self, ctxt, topic, volume_id, snapshot_id=None,
                       image_id=None, request_spec=None,
                       filter_properties=None):
+        request_spec_p = jsonutils.to_primitive(request_spec)
         return self.cast(ctxt, self.make_msg(
             'create_volume',
             topic=topic,
             volume_id=volume_id,
             snapshot_id=snapshot_id,
             image_id=image_id,
-            request_spec=request_spec,
+            request_spec=request_spec_p,
             filter_properties=filter_properties),
             version='1.2')