The top level client is unchanged. This is primarily just moving code around. The client.py file is the only location with new code, which converts the old jsonrpc_call function into a class. Change-Id: I5fb7cd48f77f6affa3d9439128009bf63148acda Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/364316 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
50 lines
1.3 KiB
Python
Executable File
50 lines
1.3 KiB
Python
Executable File
from client import print_dict, print_array, int_arg
|
|
|
|
|
|
def get_nvmf_subsystems(args):
|
|
print_dict(args.client.call('get_nvmf_subsystems', verbose=args.verbose))
|
|
|
|
|
|
def construct_nvmf_subsystem(args):
|
|
listen_addresses = [dict(u.split(":") for u in a.split(" "))
|
|
for a in args.listen.split(",")]
|
|
|
|
params = {
|
|
'nqn': args.nqn,
|
|
'listen_addresses': listen_addresses,
|
|
'serial_number': args.serial_number,
|
|
}
|
|
|
|
if args.hosts:
|
|
hosts = []
|
|
for u in args.hosts.strip().split(" "):
|
|
hosts.append(u)
|
|
params['hosts'] = hosts
|
|
|
|
if args.allow_any_host:
|
|
params['allow_any_host'] = True
|
|
|
|
if args.namespaces:
|
|
namespaces = []
|
|
for u in args.namespaces.strip().split(" "):
|
|
bdev_name = u
|
|
nsid = 0
|
|
if ':' in u:
|
|
(bdev_name, nsid) = u.split(":")
|
|
|
|
ns_params = {'bdev_name': bdev_name}
|
|
|
|
nsid = int(nsid)
|
|
if nsid != 0:
|
|
ns_params['nsid'] = nsid
|
|
|
|
namespaces.append(ns_params)
|
|
params['namespaces'] = namespaces
|
|
|
|
args.client.call('construct_nvmf_subsystem', params, verbose=args.verbose)
|
|
|
|
|
|
def delete_nvmf_subsystem(args):
|
|
params = {'nqn': args.subsystem_nqn}
|
|
args.client.call('delete_nvmf_subsystem', params, verbose=args.verbose)
|