Balazs Gibizer d8980bfed8 Align message serialization between drivers
Every in tree driver that implements RPC send uses jsonutils.dumps to
serialize the message, except FakeDriver. FakeDriver uses json.dumps.
However json.dumps is a lot more strict than jsonutils. This caused
nova to introduce test specific changes in the rpc handling [1].

This patch makes sure that each driver uses the same json serialization.

I've tried to dig in to the history of the strictness of the
FakeDriver. That driver with the json.dumps() call was added back in
2013 with e2b74cc9e6605156dfd6e36cdfd1b5136161d526. (I cannot link to
that commit in any online way but it is in my local git clone.)
Checking out that commit I don't see any other drivers present in the
repo but the code does mention drivers like RabbitDriver and ZmqDriver
in oslo.messaging/openstack/common/messaging/drivers.py but only there.

Today the oslo_messaging._drivers.common.serialize_msg() call is used
to do the final serialization of the message. It uses jsonutils.dumps
since Icd54ee8e3f5c976dfd50b4b62c7f51288649e112 which is a revert of
I0e0f6b715ffc4a9ad82be52e55696d032b6d0976 that changed from
jsonutils.dumps to jsonutils.dump_as_bytes by mistake. And before this
back and forth it was jsonutils.dumps since the code was imported from
oslo-incubator by I38507382b1ce68c7f8f697522f9a1bf00e76532d. Here
I lost the trail. Honestly I don't know the reason why the fake driver
was made stricter than the real drivers. Still I think today the
strictness is unnecessary as every driver uses jsonutils and even
counterproductive as in [1].

[1] 09bf71407f/nova/compute/rpcapi.py (L820)

Change-Id: I186305b7897a2a4ce033c11ab9e6bc028854381b
Closes-Bug: #1529084
2019-09-21 14:53:29 +02:00
2015-09-24 18:11:22 +08:00
2019-04-19 19:31:51 +00:00
2019-04-19 19:31:51 +00:00
2018-07-04 08:33:49 +07:00
2019-07-05 14:47:53 -04:00
2014-06-05 22:48:44 +02:00
2017-04-08 22:39:02 +08:00
2019-07-05 14:47:53 -04:00
2017-12-13 05:01:29 +00:00
2019-07-05 14:47:53 -04:00

Team and repository tags

image

Oslo Messaging Library

Latest Version

Downloads

The Oslo messaging API supports RPC and notifications over a number of different messaging transports.

Description
OpenStack library for messaging
Readme 36 MiB
Languages
Python 99.8%
Shell 0.2%