scripts/rpc: allow methods without params in load_config/load_subsystem_config RPC

JSON-RPC allows for methods that do not contain any params.
Turns out that so far this scenario has not occured for load_config or load_sybsystem_config
RPC, which processes JSON config file saved from previous app run.

Next patch writes out bdev_wait_for_examine to bdev subsystem
configuration. As that methods does not contain any params following
error was seen:
# /home/vagrant/spdk_repo/spdk/scripts/rpc.py load_config
Traceback (most recent call last):
  File "/home/vagrant/spdk_repo/spdk/scripts/rpc.py", line 2671, in <module>
    call_rpc_func(args)
  File "/home/vagrant/spdk_repo/spdk/scripts/rpc.py", line 2601, in call_rpc_func
    args.func(args)
  File "/home/vagrant/spdk_repo/spdk/scripts/rpc.py", line 100, in load_config
    include_aliases=args.include_aliases)
  File "/home/vagrant/spdk_repo/spdk/scripts/rpc/__init__.py", line 143, in load_config
    client.call(elem['method'], elem['params'])
KeyError: 'params'

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4a56a9d0caa4b752fb9c1fad4ae581aad8a4c2c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5860
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2021-01-08 07:50:27 -05:00
parent 77b6f4bc3e
commit c5c7de44f3

View File

@ -140,7 +140,7 @@ def load_config(client, fd, include_aliases=False):
if 'method' not in elem or elem['method'] not in allowed_methods:
continue
client.call(elem['method'], elem['params'])
client.call(**elem)
config.remove(elem)
allowed_found = True
@ -194,7 +194,7 @@ def load_subsystem_config(client, fd):
if 'method' not in elem or elem['method'] not in allowed_methods:
continue
client.call(elem['method'], elem['params'])
client.call(**elem)
config.remove(elem)
if config: