From 8770e80bda58645b779eb18eadf69a86d38a6ce8 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 23 Jun 2021 20:38:41 +0200 Subject: [PATCH] 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 Change-Id: Ie32781621317dd65e3f6fbcfd5110e7dac337f04 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8489 Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Pawel Piatek Reviewed-by: Maciej Szwed Reviewed-by: Tomasz Zawadzki Reviewed-by: Ben Walker --- scripts/rpc_http_proxy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/rpc_http_proxy.py b/scripts/rpc_http_proxy.py index ea9d17b162..da65b93aed 100755 --- a/scripts/rpc_http_proxy.py +++ b/scripts/rpc_http_proxy.py @@ -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