rpc.py: add 'discovery' nqn shortcut for nvmf listener RPCs
Now that users need to explicitly add a listener for the discovery subsystem, make that a bit easier when using rpc.py. Instead of having to type out nqn.2014-08.org.nvmexpress.discovery, allow user to just specify 'discovery' as the NQN and rpc.py will convert it to the discovery NQN before sending the RPC. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I4854d4f072f1758fdd6b37a4c3685e2a2d015caa Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11540 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
25bc221cee
commit
06ef6757a9
@ -2123,7 +2123,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
rpc.nvmf.nvmf_subsystem_add_listener(**vars(args))
|
||||
|
||||
p = subparsers.add_parser('nvmf_subsystem_add_listener', help='Add a listener to an NVMe-oF subsystem')
|
||||
p.add_argument('nqn', help='NVMe-oF subsystem NQN')
|
||||
p.add_argument('nqn', help='NVMe-oF subsystem NQN (\'discovery\' can be used as shortcut for discovery NQN)')
|
||||
p.add_argument('-t', '--trtype', help='NVMe-oF transport type: e.g., rdma', required=True)
|
||||
p.add_argument('-a', '--traddr', help='NVMe-oF transport address: e.g., an ip address', required=True)
|
||||
p.add_argument('-p', '--tgt-name', help='The name of the parent NVMe-oF target (optional)', type=str)
|
||||
@ -2141,7 +2141,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
trsvcid=args.trsvcid)
|
||||
|
||||
p = subparsers.add_parser('nvmf_subsystem_remove_listener', help='Remove a listener from an NVMe-oF subsystem')
|
||||
p.add_argument('nqn', help='NVMe-oF subsystem NQN')
|
||||
p.add_argument('nqn', help='NVMe-oF subsystem NQN (\'discovery\' can be used as shortcut for discovery NQN)')
|
||||
p.add_argument('-t', '--trtype', help='NVMe-oF transport type: e.g., rdma', required=True)
|
||||
p.add_argument('-a', '--traddr', help='NVMe-oF transport address: e.g., an ip address', required=True)
|
||||
p.add_argument('-p', '--tgt-name', help='The name of the parent NVMe-oF target (optional)', type=str)
|
||||
|
@ -256,6 +256,9 @@ def nvmf_subsystem_add_listener(client, **params):
|
||||
group_as(params, 'listen_address', ['trtype', 'traddr', 'trsvcid', 'adrfam'])
|
||||
remove_null(params)
|
||||
|
||||
if params['nqn'] == 'discovery':
|
||||
params['nqn'] = 'nqn.2014-08.org.nvmexpress.discovery'
|
||||
|
||||
return client.call('nvmf_subsystem_add_listener', params)
|
||||
|
||||
|
||||
@ -295,6 +298,9 @@ def nvmf_subsystem_remove_listener(
|
||||
if tgt_name:
|
||||
params['tgt_name'] = tgt_name
|
||||
|
||||
if params['nqn'] == 'discovery':
|
||||
params['nqn'] = 'nqn.2014-08.org.nvmexpress.discovery'
|
||||
|
||||
return client.call('nvmf_subsystem_remove_listener', params)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user