From fa9ad5e3585734f42ae235c0eb4c4518ba1c201c Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 27 Jul 2012 17:37:02 -0400 Subject: Explicitly send primitive instances via rpc. This fixes a few bugs in recent no-db-messaging commits. There were a few places that I accidentally still used "instance" where I should have used "instance_p", which is the instance converted to primitive types. I noticed the problem looking at smokestack logs. I saw a Qpid traceback that indicated the problem. As an interesting point, systems using Kombu would not have seen this problem. Kombu uses anyjson. Our jsonutils module sets anyjson to go through jsonutils, which will automatically to jsonutils.to_primitive() if needed to serialize an object. Qpid doesn't do json serialization, so it will blow up if it hits a non-primitive type. Yay for testing multiple different configurations to find problems. Part of blueprint no-db-messaging. Change-Id: I3487195110572b7ae9586cfcc618ab7ab28d5017 --- nova/compute/rpcapi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 5def90cd2..1b9f86ca0 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -203,7 +203,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): def get_vnc_console(self, ctxt, instance, console_type): instance_p = jsonutils.to_primitive(instance) return self.call(ctxt, self.make_msg('get_vnc_console', - instance=instance, console_type=console_type), + instance=instance_p, console_type=console_type), topic=_compute_topic(self.topic, ctxt, None, instance), version='1.17') @@ -228,7 +228,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): def inject_file(self, ctxt, instance, path, file_contents): instance_p = jsonutils.to_primitive(instance) self.cast(ctxt, self.make_msg('inject_file', - instance=instance, path=path, + instance=instance_p, path=path, file_contents=file_contents), topic=_compute_topic(self.topic, ctxt, None, instance), version='1.18') @@ -236,7 +236,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): def inject_network_info(self, ctxt, instance): instance_p = jsonutils.to_primitive(instance) self.cast(ctxt, self.make_msg('inject_network_info', - instance=instance), + instance=instance_p), topic=_compute_topic(self.topic, ctxt, None, instance), version='1.19') @@ -397,7 +397,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): rpc_method = self.cast if cast else self.call instance_p = jsonutils.to_primitive(instance) return rpc_method(ctxt, self.make_msg('stop_instance', - instance=instance), + instance=instance_p), topic=_compute_topic(self.topic, ctxt, None, instance), version='1.21') -- cgit