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].
Reviewed: https:/ /review. opendev. org/683600 /git.openstack. org/cgit/ openstack/ oslo.messaging/ commit/ ?id=d8980bfed86 21eadce36c6a569 44ca23245187a6
Committed: https:/
Submitter: Zuul
Branch: master
commit d8980bfed8621ea dce36c6a56944ca 23245187a6
Author: Balazs Gibizer <email address hidden>
Date: Fri Sep 20 19:33:27 2019 +0200
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 6dfd6e36cdfd1b5 136161d526. (I cannot link to openstack/ common/ messaging/ drivers. py but only there.
FakeDriver. That driver with the json.dumps() call was added back in
2013 with e2b74cc9e660515
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/
Today the oslo_messaging. _drivers. common. serialize_ msg() call is used 6dfd50b4b62c7f5 1288649e112 which is a revert of fc4a9ad82be52e5 5696d032b6d0976 that changed from dump_as_ bytes by mistake. And before this c7f8f697522f9a1 bf00e76532d. Here uctive as in [1].
to do the final serialization of the message. It uses jsonutils.dumps
since Icd54ee8e3f5c97
I0e0f6b715f
jsonutils.dumps to jsonutils.
back and forth it was jsonutils.dumps since the code was imported from
oslo-incubator by I38507382b1ce68
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
counterprod
[1] https:/ /github. com/openstack/ nova/blob/ 09bf71407f4c0d1 ddbef89c489ec87 c3bca0b7b2/ nova/compute/ rpcapi. py#L820
Change-Id: I186305b7897a2a 4ce033c11ab9e6b c028854381b
Closes-Bug: #1529084