rpc: Rename add_pg_ig_maps to iscsi_target_node_add_pg_ig_maps

Change-Id: Ie738991ef27f836a0027e64281cbda1599439240
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Pawel Kaminski 2019-09-06 04:42:19 -04:00 committed by Ben Walker
parent 8fb1cf2f18
commit a1c9546f1a
11 changed files with 33 additions and 27 deletions

View File

@ -82,7 +82,7 @@ In addition to the configuration file, the iSCSI target may also be configured v
- iscsi_create_portal_group -- Add a portal group.
- iscsi_delete_portal_group -- Delete an existing portal group.
- add_pg_ig_maps -- Add initiator group to portal group mappings to an existing iSCSI target node.
- iscsi_target_node_add_pg_ig_maps -- Add initiator group to portal group mappings to an existing iSCSI target node.
- delete_pg_ig_maps -- Delete initiator group to portal group mappings from an existing iSCSI target node.
- iscsi_get_portal_groups -- Show information about all available portal groups.

View File

@ -262,7 +262,7 @@ Example response:
"iscsi_get_portal_groups",
"delete_target_node",
"delete_pg_ig_maps",
"add_pg_ig_maps",
"iscsi_target_node_add_pg_ig_maps",
"iscsi_create_target_node",
"iscsi_get_target_nodes",
"delete_initiator_group",
@ -3275,7 +3275,7 @@ Example response:
}
~~~
## add_pg_ig_maps method {#rpc_add_pg_ig_maps}
## iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps}
Add initiator group to portal group mappings to an existing iSCSI target node.
@ -3317,7 +3317,7 @@ Example request:
"name": "iqn.2016-06.io.spdk:target3"
},
"jsonrpc": "2.0",
"method": "add_pg_ig_maps",
"method": "iscsi_target_node_add_pg_ig_maps",
"id": 1
}
~~~

View File

@ -516,8 +516,8 @@ static const struct spdk_json_object_decoder rpc_tgt_node_pg_ig_maps_decoders[]
};
static void
spdk_rpc_add_pg_ig_maps(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
spdk_rpc_iscsi_target_node_add_pg_ig_maps(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_tgt_node_pg_ig_maps req = {};
struct spdk_json_write_ctx *w;
@ -544,8 +544,8 @@ spdk_rpc_add_pg_ig_maps(struct spdk_jsonrpc_request *request,
ig_tags[i] = req.pg_ig_maps.maps[i].ig_tag;
}
rc = spdk_iscsi_tgt_node_add_pg_ig_maps(target, pg_tags, ig_tags,
req.pg_ig_maps.num_maps);
rc = spdk_iscsi_target_node_add_pg_ig_maps(target, pg_tags, ig_tags,
req.pg_ig_maps.num_maps);
if (rc < 0) {
SPDK_ERRLOG("add pg-ig maps failed\n");
goto invalid;
@ -563,7 +563,9 @@ invalid:
"Invalid parameters");
free(req.name);
}
SPDK_RPC_REGISTER("add_pg_ig_maps", spdk_rpc_add_pg_ig_maps, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("iscsi_target_node_add_pg_ig_maps",
spdk_rpc_iscsi_target_node_add_pg_ig_maps, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iscsi_target_node_add_pg_ig_maps, add_pg_ig_maps)
static void
spdk_rpc_delete_pg_ig_maps(struct spdk_jsonrpc_request *request,

View File

@ -787,8 +787,8 @@ failed:
}
int
spdk_iscsi_tgt_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list, uint16_t num_maps)
spdk_iscsi_target_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list, uint16_t num_maps)
{
uint16_t i;
int rc;
@ -993,7 +993,8 @@ spdk_iscsi_tgt_node_construct(int target_index,
}
TAILQ_INIT(&target->pg_map_head);
rc = spdk_iscsi_tgt_node_add_pg_ig_maps(target, pg_tag_list, ig_tag_list, num_maps);
rc = spdk_iscsi_target_node_add_pg_ig_maps(target, pg_tag_list,
ig_tag_list, num_maps);
if (rc != 0) {
SPDK_ERRLOG("could not add map to target\n");
iscsi_tgt_node_destruct(target, NULL, NULL);

View File

@ -127,9 +127,9 @@ spdk_iscsi_tgt_node_construct(int target_index,
bool spdk_iscsi_check_chap_params(bool disable, bool require, bool mutual, int group);
int spdk_iscsi_tgt_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list,
uint16_t num_maps);
int spdk_iscsi_target_node_add_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list,
uint16_t num_maps);
int spdk_iscsi_tgt_node_delete_pg_ig_maps(struct spdk_iscsi_tgt_node *target,
int *pg_tag_list, int *ig_tag_list,
uint16_t num_maps);

View File

@ -903,24 +903,26 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
action='store_true')
p.set_defaults(func=iscsi_target_node_set_auth)
def add_pg_ig_maps(args):
def iscsi_target_node_add_pg_ig_maps(args):
pg_ig_maps = []
for u in args.pg_ig_mappings.strip().split(" "):
pg, ig = u.split(":")
pg_ig_maps.append({"pg_tag": int(pg), "ig_tag": int(ig)})
rpc.iscsi.add_pg_ig_maps(
rpc.iscsi.iscsi_target_node_add_pg_ig_maps(
args.client,
pg_ig_maps=pg_ig_maps,
name=args.name)
p = subparsers.add_parser('add_pg_ig_maps', help='Add PG-IG maps to the target node')
p = subparsers.add_parser('iscsi_target_node_add_pg_ig_maps',
aliases=['add_pg_ig_maps'],
help='Add PG-IG maps to the target node')
p.add_argument('name', help='Target node name (ASCII)')
p.add_argument('pg_ig_mappings', help="""List of (Portal_Group_Tag:Initiator_Group_Tag) mappings
Whitespace separated, quoted, mapping defined with colon
separated list of "tags" (int > 0)
Example: '1:1 2:2 2:1'
*** The Portal/Initiator Groups must be precreated ***""")
p.set_defaults(func=add_pg_ig_maps)
p.set_defaults(func=iscsi_target_node_add_pg_ig_maps)
def delete_pg_ig_maps(args):
pg_ig_maps = []

View File

@ -348,7 +348,8 @@ def delete_pg_ig_maps(client, pg_ig_maps, name):
return client.call('delete_pg_ig_maps', params)
def add_pg_ig_maps(client, pg_ig_maps, name):
@deprecated_alias('add_pg_ig_maps')
def iscsi_target_node_add_pg_ig_maps(client, pg_ig_maps, name):
"""Add PG-IG maps to the target node.
Args:
@ -362,7 +363,7 @@ def add_pg_ig_maps(client, pg_ig_maps, name):
'name': name,
'pg_ig_maps': pg_ig_maps,
}
return client.call('add_pg_ig_maps', params)
return client.call('iscsi_target_node_add_pg_ig_maps', params)
@deprecated_alias('add_portal_group')

View File

@ -46,7 +46,7 @@ class UINode(ConfigNode):
if self.shell.interactive and\
command in ["create", "delete", "delete_all", "add_initiator",
"allow_any_host", "split_bdev", "add_lun",
"add_pg_ig_maps", "remove_target", "add_secret",
"iscsi_target_node_add_pg_ig_maps", "remove_target", "add_secret",
"destruct_split_bdev", "bdev_pmem_delete_pool",
"bdev_pmem_create_pool", "delete_secret_all",
"delete_initiator", "set_auth", "delete_secret",

View File

@ -184,7 +184,7 @@ class UIISCSIDevice(UINode):
disable_chap=disable_chap,
require_chap=require_chap, mutual_chap=mutual_chap)
def ui_command_add_pg_ig_maps(self, pg_ig_mappings):
def ui_command_iscsi_target_node_add_pg_ig_maps(self, pg_ig_mappings):
"""Add PG-IG maps to the target node.
Args:
@ -194,7 +194,7 @@ class UIISCSIDevice(UINode):
for u in pg_ig_mappings.strip().split(" "):
pg, ig = u.split(":")
pg_ig_maps.append({"pg_tag": int(pg), "ig_tag": int(ig)})
self.get_root().add_pg_ig_maps(
self.get_root().iscsi_target_node_add_pg_ig_maps(
pg_ig_maps=pg_ig_maps, name=self.device.device_name)
def ui_command_delete_pg_ig_maps(self, pg_ig_mappings):

View File

@ -436,8 +436,8 @@ class UIRoot(UINode):
rpc.iscsi.iscsi_initiator_group_remove_initiators(self.client, **kwargs)
@verbose
def add_pg_ig_maps(self, **kwargs):
rpc.iscsi.add_pg_ig_maps(self.client, **kwargs)
def iscsi_target_node_add_pg_ig_maps(self, **kwargs):
rpc.iscsi.iscsi_target_node_add_pg_ig_maps(self.client, **kwargs)
@verbose
def delete_pg_ig_maps(self, **kwargs):

View File

@ -34,7 +34,7 @@ $spdkcli_job "'/bdevs/malloc create 32 512 Malloc0' 'Malloc0' True
'/iscsi/initiator_groups add_initiator 2 ANW 10.0.2.16/32' 'hostname=ANW, netmask=10.0.2.16' True
'/iscsi/target_nodes create Target0 Target0_alias \"Malloc0:0 Malloc1:1\" 1:2 64 g=1' 'Target0' True
'/iscsi/target_nodes create Target1 Target1_alias Malloc2:0 1:2 64 g=1' 'Target1' True
'/iscsi/target_nodes/iqn.2016-06.io.spdk:Target0 add_pg_ig_maps \"1:3 2:2\"' 'portal_group1 - initiator_group3' True
'/iscsi/target_nodes/iqn.2016-06.io.spdk:Target0 iscsi_target_node_add_pg_ig_maps \"1:3 2:2\"' 'portal_group1 - initiator_group3' True
'/iscsi/target_nodes add_lun iqn.2016-06.io.spdk:Target1 Malloc3 2' 'Malloc3' True
'/iscsi/auth_groups create 1 \"user:test1 secret:test1 muser:mutual_test1 msecret:mutual_test1,\
user:test3 secret:test3 muser:mutual_test3 msecret:mutual_test3\"' 'user=test3' True