nvmf: Make anagrpid configurable when adding ns to subsystem by RPC
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I77e2e79889edb87374d81638380887ccc711818a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9114 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
785d10b5c7
commit
694fa34d65
@ -11,6 +11,8 @@ An `opts_size` element was added in the `spdk_nvmf_ns_opts` structure to solve t
|
||||
ABI compatibility issue between different SPDK version. An new option `anagrpid` was
|
||||
added in the `spdk_nvmf_ns_opts` structure.
|
||||
|
||||
An new parameter `anagrpid` was added to the RPC `nvmf_subsystem_add_ns`.
|
||||
|
||||
### bdev
|
||||
|
||||
New API `spdk_bdev_get_memory_domains` has been added, it allows to get SPDK memory domains used by bdev.
|
||||
|
@ -6343,6 +6343,7 @@ nguid | Optional | string | 16-byte namespace globally un
|
||||
eui64 | Optional | string | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
|
||||
uuid | Optional | string | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
|
||||
ptpl_file | Optional | string | File path to save/restore persistent reservation information
|
||||
anagrpid | Optional | number | ANA group ID. Default: Namespace ID.
|
||||
|
||||
#### Example
|
||||
|
||||
|
@ -562,6 +562,10 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
|
||||
spdk_json_write_named_string(w, "uuid", uuid_str);
|
||||
}
|
||||
|
||||
if (nvmf_subsystem_get_ana_reporting(subsystem)) {
|
||||
spdk_json_write_named_uint32(w, "anagrpid", ns_opts.anagrpid);
|
||||
}
|
||||
|
||||
/* "namespace" */
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
|
@ -291,6 +291,10 @@ dump_nvmf_subsystem(struct spdk_json_write_ctx *w, struct spdk_nvmf_subsystem *s
|
||||
spdk_json_write_named_string(w, "uuid", uuid_str);
|
||||
}
|
||||
|
||||
if (nvmf_subsystem_get_ana_reporting(subsystem)) {
|
||||
spdk_json_write_named_uint32(w, "anagrpid", ns_opts.anagrpid);
|
||||
}
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
}
|
||||
spdk_json_write_array_end(w);
|
||||
@ -1078,6 +1082,7 @@ struct spdk_nvmf_ns_params {
|
||||
char nguid[16];
|
||||
char eui64[8];
|
||||
struct spdk_uuid uuid;
|
||||
uint32_t anagrpid;
|
||||
};
|
||||
|
||||
static const struct spdk_json_object_decoder rpc_ns_params_decoders[] = {
|
||||
@ -1087,6 +1092,7 @@ static const struct spdk_json_object_decoder rpc_ns_params_decoders[] = {
|
||||
{"nguid", offsetof(struct spdk_nvmf_ns_params, nguid), decode_ns_nguid, true},
|
||||
{"eui64", offsetof(struct spdk_nvmf_ns_params, eui64), decode_ns_eui64, true},
|
||||
{"uuid", offsetof(struct spdk_nvmf_ns_params, uuid), decode_ns_uuid, true},
|
||||
{"anagrpid", offsetof(struct spdk_nvmf_ns_params, anagrpid), spdk_json_decode_uint32, true},
|
||||
};
|
||||
|
||||
static int
|
||||
@ -1204,6 +1210,8 @@ nvmf_rpc_ns_paused(struct spdk_nvmf_subsystem *subsystem,
|
||||
ns_opts.uuid = ctx->ns_params.uuid;
|
||||
}
|
||||
|
||||
ns_opts.anagrpid = ctx->ns_params.anagrpid;
|
||||
|
||||
ctx->ns_params.nsid = spdk_nvmf_subsystem_add_ns_ext(subsystem, ctx->ns_params.bdev_name,
|
||||
&ns_opts, sizeof(ns_opts),
|
||||
ctx->ns_params.ptpl_file);
|
||||
|
@ -2056,7 +2056,8 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
nsid=args.nsid,
|
||||
nguid=args.nguid,
|
||||
eui64=args.eui64,
|
||||
uuid=args.uuid)
|
||||
uuid=args.uuid,
|
||||
anagrpid=args.anagrpid)
|
||||
|
||||
p = subparsers.add_parser('nvmf_subsystem_add_ns', help='Add a namespace to an NVMe-oF subsystem')
|
||||
p.add_argument('nqn', help='NVMe-oF subsystem NQN')
|
||||
@ -2067,6 +2068,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
p.add_argument('-g', '--nguid', help='Namespace globally unique identifier (optional)')
|
||||
p.add_argument('-e', '--eui64', help='Namespace EUI-64 identifier (optional)')
|
||||
p.add_argument('-u', '--uuid', help='Namespace UUID (optional)')
|
||||
p.add_argument('-a', '--anagrpid', help='ANA group ID (optional)', type=int)
|
||||
p.set_defaults(func=nvmf_subsystem_add_ns)
|
||||
|
||||
def nvmf_subsystem_remove_ns(args):
|
||||
|
@ -332,7 +332,16 @@ def nvmf_subsystem_listener_set_ana_state(
|
||||
return client.call('nvmf_subsystem_listener_set_ana_state', params)
|
||||
|
||||
|
||||
def nvmf_subsystem_add_ns(client, nqn, bdev_name, tgt_name=None, ptpl_file=None, nsid=None, nguid=None, eui64=None, uuid=None):
|
||||
def nvmf_subsystem_add_ns(client,
|
||||
nqn,
|
||||
bdev_name,
|
||||
tgt_name=None,
|
||||
ptpl_file=None,
|
||||
nsid=None,
|
||||
nguid=None,
|
||||
eui64=None,
|
||||
uuid=None,
|
||||
anagrpid=None):
|
||||
"""Add a namespace to a subsystem.
|
||||
|
||||
Args:
|
||||
@ -343,6 +352,7 @@ def nvmf_subsystem_add_ns(client, nqn, bdev_name, tgt_name=None, ptpl_file=None,
|
||||
nguid: 16-byte namespace globally unique identifier in hexadecimal (optional).
|
||||
eui64: 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789") (optional).
|
||||
uuid: Namespace UUID (optional).
|
||||
anagrpid: ANA group ID (optional).
|
||||
|
||||
Returns:
|
||||
The namespace ID
|
||||
@ -364,6 +374,9 @@ def nvmf_subsystem_add_ns(client, nqn, bdev_name, tgt_name=None, ptpl_file=None,
|
||||
if uuid:
|
||||
ns['uuid'] = uuid
|
||||
|
||||
if anagrpid:
|
||||
ns['anagrpid'] = anagrpid
|
||||
|
||||
params = {'nqn': nqn,
|
||||
'namespace': ns}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user