Commit 1da94ed7 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

rpc/nvmf: Add ana_reporting parameter to nvmf_create_subsystem RPC



Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9adc8373050e68872a4d9e89518c137e61005254
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3852


Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 6f226573
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4324,6 +4324,7 @@ serial_number | Optional | string | Serial number of virtual cont
model_number            | Optional | string      | Model number of virtual controller
max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host whitelist (`false`). Default: `false`.
ana_reporting           | Optional | boolean     | Enable ANA reporting feature (default: `false`).

### Example

+4 −0
Original line number Diff line number Diff line
@@ -344,6 +344,7 @@ struct rpc_subsystem_create {
	char *tgt_name;
	uint32_t max_namespaces;
	bool allow_any_host;
	bool ana_reporting;
};

static const struct spdk_json_object_decoder rpc_subsystem_create_decoders[] = {
@@ -353,6 +354,7 @@ static const struct spdk_json_object_decoder rpc_subsystem_create_decoders[] = {
	{"tgt_name", offsetof(struct rpc_subsystem_create, tgt_name), spdk_json_decode_string, true},
	{"max_namespaces", offsetof(struct rpc_subsystem_create, max_namespaces), spdk_json_decode_uint32, true},
	{"allow_any_host", offsetof(struct rpc_subsystem_create, allow_any_host), spdk_json_decode_bool, true},
	{"ana_reporting", offsetof(struct rpc_subsystem_create, ana_reporting), spdk_json_decode_bool, true},
};

static void
@@ -435,6 +437,8 @@ rpc_nvmf_create_subsystem(struct spdk_jsonrpc_request *request,

	spdk_nvmf_subsystem_set_allow_any_host(subsystem, req->allow_any_host);

	spdk_nvmf_subsystem_set_ana_reporting(subsystem, req->ana_reporting);

	rc = spdk_nvmf_subsystem_start(subsystem,
				       rpc_nvmf_subsystem_started,
				       request);
+3 −1
Original line number Diff line number Diff line
@@ -1848,7 +1848,8 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
                                       serial_number=args.serial_number,
                                       model_number=args.model_number,
                                       allow_any_host=args.allow_any_host,
                                       max_namespaces=args.max_namespaces)
                                       max_namespaces=args.max_namespaces,
                                       ana_reporting=args.ana_reporting)

    p = subparsers.add_parser('nvmf_create_subsystem', aliases=['nvmf_subsystem_create'],
                              help='Create an NVMe-oF subsystem')
@@ -1863,6 +1864,7 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
    p.add_argument("-a", "--allow-any-host", action='store_true', help="Allow any host to connect (don't enforce host NQN whitelist)")
    p.add_argument("-m", "--max-namespaces", help="Maximum number of namespaces allowed",
                   type=int, default=0)
    p.add_argument("-r", "--ana-reporting", action='store_true', help="Enable ANA reporting feature")
    p.set_defaults(func=nvmf_create_subsystem)

    def nvmf_delete_subsystem(args):
+7 −1
Original line number Diff line number Diff line
@@ -221,7 +221,8 @@ def nvmf_create_subsystem(client,
                          tgt_name=None,
                          model_number='SPDK bdev Controller',
                          allow_any_host=False,
                          max_namespaces=0):
                          max_namespaces=0,
                          ana_reporting=False):
    """Construct an NVMe over Fabrics target subsystem.

    Args:
@@ -231,6 +232,8 @@ def nvmf_create_subsystem(client,
        model_number: Model number of virtual controller.
        allow_any_host: Allow any host (True) or enforce allowed host whitelist (False). Default: False.
        max_namespaces: Maximum number of namespaces that can be attached to the subsystem (optional). Default: 0 (Unlimited).
        ana_reporting: Enable ANA reporting feature. Default: False.


    Returns:
        True or False
@@ -254,6 +257,9 @@ def nvmf_create_subsystem(client,
    if tgt_name:
        params['tgt_name'] = tgt_name

    if ana_reporting:
        params['ana_reporting'] = ana_reporting

    return client.call('nvmf_create_subsystem', params)