rpc: Rename get_iscsi_connections to iscsi_get_connections

Change-Id: Iffdf67005c14551f1aaa03e58e6773d298cc604b
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467927
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Pawel Kaminski 2019-09-10 05:32:18 -04:00 committed by Ben Walker
parent 7188bb994f
commit 6d77994169
7 changed files with 31 additions and 29 deletions

View File

@ -256,7 +256,7 @@ Example response:
"set_log_print_level", "set_log_print_level",
"get_iscsi_global_params", "get_iscsi_global_params",
"target_node_add_lun", "target_node_add_lun",
"get_iscsi_connections", "iscsi_get_connections",
"iscsi_delete_portal_group", "iscsi_delete_portal_group",
"iscsi_create_portal_group", "iscsi_create_portal_group",
"iscsi_get_portal_groups", "iscsi_get_portal_groups",
@ -3550,7 +3550,7 @@ Example response:
} }
~~~ ~~~
## get_iscsi_connections method {#rpc_get_iscsi_connections} ## iscsi_get_connections method {#rpc_iscsi_get_connections}
Show information about all active connections. Show information about all active connections.
@ -3579,7 +3579,7 @@ Example request:
~~~ ~~~
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "get_iscsi_connections", "method": "iscsi_get_connections",
"id": 1 "id": 1
} }
~~~ ~~~

View File

@ -888,15 +888,15 @@ invalid:
SPDK_RPC_REGISTER("iscsi_delete_portal_group", spdk_rpc_iscsi_delete_portal_group, SPDK_RPC_RUNTIME) SPDK_RPC_REGISTER("iscsi_delete_portal_group", spdk_rpc_iscsi_delete_portal_group, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iscsi_delete_portal_group, delete_portal_group) SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iscsi_delete_portal_group, delete_portal_group)
struct rpc_get_iscsi_connections_ctx { struct rpc_iscsi_get_connections_ctx {
struct spdk_jsonrpc_request *request; struct spdk_jsonrpc_request *request;
struct spdk_json_write_ctx *w; struct spdk_json_write_ctx *w;
}; };
static void static void
rpc_get_iscsi_connections_done(struct spdk_io_channel_iter *i, int status) rpc_iscsi_get_connections_done(struct spdk_io_channel_iter *i, int status)
{ {
struct rpc_get_iscsi_connections_ctx *ctx = spdk_io_channel_iter_get_ctx(i); struct rpc_iscsi_get_connections_ctx *ctx = spdk_io_channel_iter_get_ctx(i);
spdk_json_write_array_end(ctx->w); spdk_json_write_array_end(ctx->w);
spdk_jsonrpc_end_result(ctx->request, ctx->w); spdk_jsonrpc_end_result(ctx->request, ctx->w);
@ -905,9 +905,9 @@ rpc_get_iscsi_connections_done(struct spdk_io_channel_iter *i, int status)
} }
static void static void
rpc_get_iscsi_connections(struct spdk_io_channel_iter *i) rpc_iscsi_get_connections(struct spdk_io_channel_iter *i)
{ {
struct rpc_get_iscsi_connections_ctx *ctx = spdk_io_channel_iter_get_ctx(i); struct rpc_iscsi_get_connections_ctx *ctx = spdk_io_channel_iter_get_ctx(i);
struct spdk_io_channel *ch = spdk_io_channel_iter_get_channel(i); struct spdk_io_channel *ch = spdk_io_channel_iter_get_channel(i);
struct spdk_iscsi_poll_group *pg = spdk_io_channel_get_ctx(ch); struct spdk_iscsi_poll_group *pg = spdk_io_channel_get_ctx(ch);
struct spdk_iscsi_conn *conn; struct spdk_iscsi_conn *conn;
@ -920,18 +920,18 @@ rpc_get_iscsi_connections(struct spdk_io_channel_iter *i)
} }
static void static void
spdk_rpc_get_iscsi_connections(struct spdk_jsonrpc_request *request, spdk_rpc_iscsi_get_connections(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct rpc_get_iscsi_connections_ctx *ctx; struct rpc_iscsi_get_connections_ctx *ctx;
if (params != NULL) { if (params != NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"get_iscsi_connections requires no parameters"); "iscsi_get_connections requires no parameters");
return; return;
} }
ctx = calloc(1, sizeof(struct rpc_get_iscsi_connections_ctx)); ctx = calloc(1, sizeof(struct rpc_iscsi_get_connections_ctx));
if (ctx == NULL) { if (ctx == NULL) {
SPDK_ERRLOG("Failed to allocate rpc_get_iscsi_conns_ctx struct\n"); SPDK_ERRLOG("Failed to allocate rpc_get_iscsi_conns_ctx struct\n");
spdk_jsonrpc_send_error_response(request, -ENOMEM, spdk_strerror(ENOMEM)); spdk_jsonrpc_send_error_response(request, -ENOMEM, spdk_strerror(ENOMEM));
@ -944,11 +944,12 @@ spdk_rpc_get_iscsi_connections(struct spdk_jsonrpc_request *request,
spdk_json_write_array_begin(ctx->w); spdk_json_write_array_begin(ctx->w);
spdk_for_each_channel(&g_spdk_iscsi, spdk_for_each_channel(&g_spdk_iscsi,
rpc_get_iscsi_connections, rpc_iscsi_get_connections,
ctx, ctx,
rpc_get_iscsi_connections_done); rpc_iscsi_get_connections_done);
} }
SPDK_RPC_REGISTER("get_iscsi_connections", spdk_rpc_get_iscsi_connections, SPDK_RPC_RUNTIME) SPDK_RPC_REGISTER("iscsi_get_connections", spdk_rpc_iscsi_get_connections, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iscsi_get_connections, get_iscsi_connections)
struct rpc_target_lun { struct rpc_target_lun {
char *name; char *name;

View File

@ -1071,12 +1071,12 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
'tag', help='Initiator group tag (unique, integer > 0)', type=int) 'tag', help='Initiator group tag (unique, integer > 0)', type=int)
p.set_defaults(func=delete_initiator_group) p.set_defaults(func=delete_initiator_group)
def get_iscsi_connections(args): def iscsi_get_connections(args):
print_dict(rpc.iscsi.get_iscsi_connections(args.client)) print_dict(rpc.iscsi.iscsi_get_connections(args.client))
p = subparsers.add_parser('get_iscsi_connections', p = subparsers.add_parser('iscsi_get_connections', aliases=['get_iscsi_connections'],
help='Display iSCSI connections') help='Display iSCSI connections')
p.set_defaults(func=get_iscsi_connections) p.set_defaults(func=iscsi_get_connections)
def get_iscsi_global_params(args): def get_iscsi_global_params(args):
print_dict(rpc.iscsi.get_iscsi_global_params(args.client)) print_dict(rpc.iscsi.get_iscsi_global_params(args.client))

View File

@ -480,13 +480,14 @@ def delete_initiator_group(client, tag):
return client.call('delete_initiator_group', params) return client.call('delete_initiator_group', params)
def get_iscsi_connections(client): @deprecated_alias('get_iscsi_connections')
def iscsi_get_connections(client):
"""Display iSCSI connections. """Display iSCSI connections.
Returns: Returns:
List of iSCSI connection. List of iSCSI connection.
""" """
return client.call('get_iscsi_connections') return client.call('iscsi_get_connections')
def get_iscsi_global_params(client): def get_iscsi_global_params(client):

View File

@ -481,7 +481,7 @@ class UIISCSIConnections(UINode):
def refresh(self): def refresh(self):
self._children = set([]) self._children = set([])
self.iscsicons = list(self.get_root().get_iscsi_connections()) self.iscsicons = list(self.get_root().iscsi_get_connections())
for ic in self.iscsicons: for ic in self.iscsicons:
UIISCSIConnection(ic, self) UIISCSIConnection(ic, self)

View File

@ -422,9 +422,9 @@ class UIRoot(UINode):
@verbose @verbose
@is_method_available @is_method_available
def get_iscsi_connections(self, **kwargs): def iscsi_get_connections(self, **kwargs):
if self.is_init: if self.is_init:
for ic in rpc.iscsi.get_iscsi_connections(self.client, **kwargs): for ic in rpc.iscsi.iscsi_get_connections(self.client, **kwargs):
yield ic yield ic
@verbose @verbose

View File

@ -96,10 +96,10 @@ def verify_log_flag_rpc_methods(rpc_py, rpc_param):
def verify_iscsi_connection_rpc_methods(rpc_py): def verify_iscsi_connection_rpc_methods(rpc_py):
rpc = spdk_rpc(rpc_py) rpc = spdk_rpc(rpc_py)
output = rpc.get_iscsi_connections() output = rpc.iscsi_get_connections()
jsonvalue = json.loads(output) jsonvalue = json.loads(output)
verify(not jsonvalue, 1, verify(not jsonvalue, 1,
"get_iscsi_connections returned {}, expected empty".format(jsonvalue)) "iscsi_get_connections returned {}, expected empty".format(jsonvalue))
rpc.bdev_malloc_create(rpc_param['malloc_bdev_size'], rpc_param['malloc_block_size']) rpc.bdev_malloc_create(rpc_param['malloc_bdev_size'], rpc_param['malloc_block_size'])
rpc.iscsi_create_portal_group(portal_tag, "{}:{}".format(rpc_param['target_ip'], str(rpc_param['port']))) rpc.iscsi_create_portal_group(portal_tag, "{}:{}".format(rpc_param['target_ip'], str(rpc_param['port'])))
@ -112,7 +112,7 @@ def verify_iscsi_connection_rpc_methods(rpc_py):
check_output('iscsiadm -m discovery -t st -p {}'.format(rpc_param['target_ip']), shell=True) check_output('iscsiadm -m discovery -t st -p {}'.format(rpc_param['target_ip']), shell=True)
check_output('iscsiadm -m node --login', shell=True) check_output('iscsiadm -m node --login', shell=True)
name = json.loads(rpc.iscsi_get_target_nodes())[0]['name'] name = json.loads(rpc.iscsi_get_target_nodes())[0]['name']
output = rpc.get_iscsi_connections() output = rpc.iscsi_get_connections()
jsonvalues = json.loads(output) jsonvalues = json.loads(output)
verify(jsonvalues[0]['target_node_name'] == rpc_param['target_name'], 1, verify(jsonvalues[0]['target_node_name'] == rpc_param['target_name'], 1,
"target node name vaule is {}, expected {}".format(jsonvalues[0]['target_node_name'], rpc_param['target_name'])) "target node name vaule is {}, expected {}".format(jsonvalues[0]['target_node_name'], rpc_param['target_name']))
@ -128,10 +128,10 @@ def verify_iscsi_connection_rpc_methods(rpc_py):
rpc.delete_initiator_group(initiator_tag) rpc.delete_initiator_group(initiator_tag)
rpc.iscsi_delete_portal_group(portal_tag) rpc.iscsi_delete_portal_group(portal_tag)
rpc.delete_target_node(name) rpc.delete_target_node(name)
output = rpc.get_iscsi_connections() output = rpc.iscsi_get_connections()
jsonvalues = json.loads(output) jsonvalues = json.loads(output)
verify(not jsonvalues, 1, verify(not jsonvalues, 1,
"get_iscsi_connections returned {}, expected empty".format(jsonvalues)) "iscsi_get_connections returned {}, expected empty".format(jsonvalues))
print("verify_iscsi_connection_rpc_methods passed") print("verify_iscsi_connection_rpc_methods passed")