scripts/rpc_http_proxy: Print to stdout POSTed json rpc calls and responses

It's useful to determine what's being sent out to the server. This
may be relevant for e.g. openstack tests where currently it's hard
to see what tempest|cinder is actually doing, SPDK-wise, during the
tests.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie32781621317dd65e3f6fbcfd5110e7dac337f04
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8489
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Michal Berger 2021-06-23 20:38:41 +02:00 committed by Ben Walker
parent cd1261ae00
commit 8770e80bda

View File

@ -12,6 +12,7 @@ try:
except ImportError:
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
from rpc.client import print_json
rpc_sock = None
@ -45,6 +46,8 @@ def rpc_call(req):
closed = False
response = None
print_json(req.decode('ascii'))
while not closed:
newdata = sock.recv(1024)
if (newdata == b''):
@ -61,6 +64,8 @@ def rpc_call(req):
if not response and len(buf) > 0:
raise
print_json(buf)
return buf