rpc.py: print better message if cannot connect
We need to catch the JSONRPCException when we cannot connect, so that the error message can be printed more cleanly. Also suggest to the user that maybe they don't have an SPDK application running when it cannot connect. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I497bed86573d5bf07a2b48b3d6682a2427aa4987 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6754 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Monica Kenguva <monica.kenguva@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
38736d993d
commit
9713bfe90d
@ -2691,9 +2691,14 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
print_json = null_print
|
||||
print_array = null_print
|
||||
else:
|
||||
args.client = rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout,
|
||||
log_level=getattr(logging, args.verbose.upper()),
|
||||
conn_retries=args.conn_retries)
|
||||
try:
|
||||
args.client = rpc.client.JSONRPCClient(args.server_addr, args.port, args.timeout,
|
||||
log_level=getattr(logging, args.verbose.upper()),
|
||||
conn_retries=args.conn_retries)
|
||||
except JSONRPCException as ex:
|
||||
print(ex.message)
|
||||
exit(1)
|
||||
|
||||
if hasattr(args, 'func'):
|
||||
try:
|
||||
call_rpc_func(args)
|
||||
|
@ -73,6 +73,7 @@ class JSONRPCClient(object):
|
||||
raise socket.error("Unix socket '%s' does not exist" % addr)
|
||||
except socket.error as ex:
|
||||
raise JSONRPCException("Error while connecting to %s\n"
|
||||
"Is SPDK application running?\n"
|
||||
"Error details: %s" % (addr, ex))
|
||||
|
||||
def get_logger(self):
|
||||
|
Loading…
Reference in New Issue
Block a user