Skip to content
Snippets Groups Projects
Commit 3425eac6 authored by Liang Zhen's avatar Liang Zhen
Browse files

Branch HEAD

. Show_error command
. warning if server group has userland test nodes
. lst depends on LND_LIBS
parent 58e0a812
No related branches found
No related tags found
No related merge requests found
...@@ -396,6 +396,7 @@ typedef struct { ...@@ -396,6 +396,7 @@ typedef struct {
lstio_bulk_param_t, lstio_bulk_param_t,
lstio_ping_param_t, lstio_ping_param_t,
... more */ ... more */
int *lstio_tes_retp; /* OUT: private returned value */
struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */ struct list_head *lstio_tes_resultp; /* OUT: list head of result buffer */
} lstio_test_args_t; } lstio_test_args_t;
......
...@@ -685,9 +685,11 @@ int lst_test_add_ioctl(lstio_test_args_t *args) ...@@ -685,9 +685,11 @@ int lst_test_add_ioctl(lstio_test_args_t *args)
char *srcgrp = NULL; char *srcgrp = NULL;
char *dstgrp = NULL; char *dstgrp = NULL;
void *param = NULL; void *param = NULL;
int ret = 0;
int rc = -ENOMEM; int rc = -ENOMEM;
if (args->lstio_tes_resultp == NULL || if (args->lstio_tes_resultp == NULL ||
args->lstio_tes_retp == NULL ||
args->lstio_tes_bat_name == NULL || /* no specified batch */ args->lstio_tes_bat_name == NULL || /* no specified batch */
args->lstio_tes_bat_nmlen <= 0 || args->lstio_tes_bat_nmlen <= 0 ||
args->lstio_tes_bat_nmlen > LST_NAME_SIZE || args->lstio_tes_bat_nmlen > LST_NAME_SIZE ||
...@@ -743,7 +745,11 @@ int lst_test_add_ioctl(lstio_test_args_t *args) ...@@ -743,7 +745,11 @@ int lst_test_add_ioctl(lstio_test_args_t *args)
args->lstio_tes_concur, args->lstio_tes_concur,
args->lstio_tes_dist, args->lstio_tes_span, args->lstio_tes_dist, args->lstio_tes_span,
srcgrp, dstgrp, param, args->lstio_tes_param_len, srcgrp, dstgrp, param, args->lstio_tes_param_len,
args->lstio_tes_resultp); &ret, args->lstio_tes_resultp);
if (ret != 0)
rc = (copy_to_user(args->lstio_tes_retp, &ret, sizeof(ret))) ?
-EFAULT : 0;
out: out:
if (name != NULL) if (name != NULL)
LIBCFS_FREE(name, args->lstio_tes_bat_nmlen + 1); LIBCFS_FREE(name, args->lstio_tes_bat_nmlen + 1);
......
...@@ -1204,7 +1204,7 @@ again: ...@@ -1204,7 +1204,7 @@ again:
int int
lstcon_test_add(char *name, int type, int loop, int concur, lstcon_test_add(char *name, int type, int loop, int concur,
int dist, int span, char *src_name, char * dst_name, int dist, int span, char *src_name, char * dst_name,
void *param, int paramlen, struct list_head *result_up) void *param, int paramlen, int *retp, struct list_head *result_up)
{ {
lstcon_group_t *src_grp = NULL; lstcon_group_t *src_grp = NULL;
...@@ -1236,6 +1236,9 @@ lstcon_test_add(char *name, int type, int loop, int concur, ...@@ -1236,6 +1236,9 @@ lstcon_test_add(char *name, int type, int loop, int concur,
goto out; goto out;
} }
if (dst_grp->grp_userland)
*retp = 1;
LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen])); LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen]));
if (!test) { if (!test) {
CERROR("Can't allocate test descriptor\n"); CERROR("Can't allocate test descriptor\n");
...@@ -1849,6 +1852,9 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc) ...@@ -1849,6 +1852,9 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
ndl->ndl_node->nd_state = LST_NODE_ACTIVE; ndl->ndl_node->nd_state = LST_NODE_ACTIVE;
ndl->ndl_node->nd_timeout = console_session.ses_timeout; ndl->ndl_node->nd_timeout = console_session.ses_timeout;
if (grp->grp_userland == 0)
grp->grp_userland = 1;
strcpy(jrep->join_session, console_session.ses_name); strcpy(jrep->join_session, console_session.ses_name);
jrep->join_timeout = console_session.ses_timeout; jrep->join_timeout = console_session.ses_timeout;
jrep->join_status = 0; jrep->join_status = 0;
......
...@@ -38,6 +38,7 @@ typedef struct { ...@@ -38,6 +38,7 @@ typedef struct {
typedef struct { typedef struct {
struct list_head grp_link; /* chain on global group list */ struct list_head grp_link; /* chain on global group list */
int grp_ref; /* reference count */ int grp_ref; /* reference count */
int grp_userland; /* has userland nodes */
int grp_nnode; /* # of nodes */ int grp_nnode; /* # of nodes */
char grp_name[LST_NAME_SIZE]; /* group name */ char grp_name[LST_NAME_SIZE]; /* group name */
...@@ -184,7 +185,7 @@ extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up, ...@@ -184,7 +185,7 @@ extern int lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
int timeout, struct list_head *result_up); int timeout, struct list_head *result_up);
extern int lstcon_test_add(char *name, int type, int loop, int concur, extern int lstcon_test_add(char *name, int type, int loop, int concur,
int dist, int span, char *src_name, char * dst_name, int dist, int span, char *src_name, char * dst_name,
void *param, int paramlen, struct list_head *result_up); void *param, int paramlen, int *retp, struct list_head *result_up);
#endif #endif
#endif #endif
...@@ -68,7 +68,7 @@ endif ...@@ -68,7 +68,7 @@ endif
if LIBLUSTRE if LIBLUSTRE
LIB_SELFTEST = $(top_builddir)/lnet/libcfs/libcfs.a $(top_builddir)/lnet/lnet/liblnet.a $(top_builddir)/lnet/selftest/libselftest.a LIB_SELFTEST = $(top_builddir)/lnet/libcfs/libcfs.a $(top_builddir)/lnet/lnet/liblnet.a $(top_builddir)/lnet/selftest/libselftest.a
liblst.a : $(LIB_SELFTEST) liblst.a : $(LIB_SELFTEST) $(LND_LIBS)
sh $(srcdir)/genlib.sh "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)" sh $(srcdir)/genlib.sh "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)"
lstclient_SOURCES = lstclient.c lstclient_SOURCES = lstclient.c
......
...@@ -1895,6 +1895,132 @@ out: ...@@ -1895,6 +1895,132 @@ out:
return rc; return rc;
} }
int
jt_lst_show_error(int argc, char **argv)
{
struct list_head head;
lst_stat_req_param_t *srp;
lstcon_rpc_ent_t *ent;
sfw_counters_t *sfwk;
srpc_counters_t *srpc;
lnet_counters_t *lnet;
lnet_process_id_t *idsp = NULL;
char *name = NULL;
int optidx = 0;
int count = 0;
int type = 0;
int timeout = 5;
int ecount = 0;
int rc;
int c;
static struct option show_error_opts[] =
{
{"group" , required_argument, 0, 'g' },
{"nodes" , required_argument, 0, 'n' },
{0, 0, 0, 0 }
};
if (session_key == 0) {
fprintf(stderr,
"Can't find env LST_SESSION or value is not valid\n");
return -1;
}
while (1) {
c = getopt_long(argc, argv, "g:n:", show_error_opts, &optidx);
if (c == -1)
break;
switch (c) {
case 'g':
type = LST_OPC_GROUP;
name = optarg;
break;
case 'n':
type = LST_OPC_NODES;
name = optarg;
break;
default:
lst_print_usage(argv[0]);
return -1;
}
}
if (optind != argc || type == 0) {
lst_print_usage(argv[0]);
return -1;
}
if (name == NULL) {
fprintf(stderr, "Missing name of target (group | nodes)\n");
return -1;
}
rc = lst_get_node_count(type, name, &count, &idsp);
if (rc < 0) {
fprintf(stderr, "Failed to get count of nodes from %s: %s\n",
name, strerror(errno));
return -1;
}
CFS_INIT_LIST_HEAD(&head);
rc = lst_alloc_rpcent(&head, count, sizeof(sfw_counters_t) +
sizeof(srpc_counters_t) +
sizeof(lnet_counters_t));
if (rc != 0) {
fprintf(stderr, "Out of memory\n");
goto out;
}
rc = lst_stat_ioctl(name, count, idsp, timeout, &head);
if (rc == -1) {
lst_print_error(name, "Failed to show errors of %s: %s\n",
name, strerror(errno));
goto out;
}
list_for_each_entry(ent, &head, rpe_link) {
if (ent->rpe_rpc_errno != 0) {
ecount ++;
fprintf(stderr, "RPC failure, can't show error on %s\n",
libcfs_id2str(ent->rpe_peer));
continue;
}
if (ent->rpe_fwk_errno != 0) {
ecount ++;
fprintf(stderr, "Framework failure, can't show error on %s\n",
libcfs_id2str(ent->rpe_peer));
continue;
}
sfwk = (sfw_counters_t *)&ent->rpe_payload[0];
srpc = (srpc_counters_t *)((char *)sfwk + sizeof(*sfwk));
lnet = (lnet_counters_t *)((char *)srpc + sizeof(*srpc));
if (srpc->errors == 0 &&
sfwk->brw_errors == 0 && sfwk->ping_errors == 0)
continue;
ecount ++;
fprintf(stderr, "[%s]: %d RPC errors, %d brw errors, %d ping errors\n",
libcfs_id2str(ent->rpe_peer), srpc->errors,
sfwk->brw_errors, sfwk->ping_errors);
}
fprintf(stdout, "Total %d errors in %s\n", ecount, name);
out:
lst_free_rpcent(&head);
if (idsp != NULL)
free(idsp);
return 0;
}
int int
lst_add_batch_ioctl (char *name) lst_add_batch_ioctl (char *name)
{ {
...@@ -2737,7 +2863,7 @@ lst_get_test_param(char *test, int argc, char **argv, void **param, int *plen) ...@@ -2737,7 +2863,7 @@ lst_get_test_param(char *test, int argc, char **argv, void **param, int *plen)
int int
lst_add_test_ioctl(char *batch, int type, int loop, int concur, lst_add_test_ioctl(char *batch, int type, int loop, int concur,
int dist, int span, char *sgrp, char *dgrp, int dist, int span, char *sgrp, char *dgrp,
void *param, int plen, struct list_head *resultp) void *param, int plen, int *retp, struct list_head *resultp)
{ {
lstio_test_args_t args = { lstio_test_args_t args = {
.lstio_tes_key = session_key, .lstio_tes_key = session_key,
...@@ -2754,6 +2880,7 @@ lst_add_test_ioctl(char *batch, int type, int loop, int concur, ...@@ -2754,6 +2880,7 @@ lst_add_test_ioctl(char *batch, int type, int loop, int concur,
.lstio_tes_dgrp_name = dgrp, .lstio_tes_dgrp_name = dgrp,
.lstio_tes_param_len = plen, .lstio_tes_param_len = plen,
.lstio_tes_param = param, .lstio_tes_param = param,
.lstio_tes_retp = retp,
.lstio_tes_resultp = resultp, .lstio_tes_resultp = resultp,
}; };
...@@ -2778,6 +2905,7 @@ jt_lst_add_test(int argc, char **argv) ...@@ -2778,6 +2905,7 @@ jt_lst_add_test(int argc, char **argv)
int plen = 0; int plen = 0;
int fcount = 0; int fcount = 0;
int tcount = 0; int tcount = 0;
int ret = 0;
int type; int type;
int rc; int rc;
int c; int c;
...@@ -2888,10 +3016,16 @@ jt_lst_add_test(int argc, char **argv) ...@@ -2888,10 +3016,16 @@ jt_lst_add_test(int argc, char **argv)
} }
rc = lst_add_test_ioctl(batch, type, loop, concur, rc = lst_add_test_ioctl(batch, type, loop, concur,
dist, span, from, to, param, plen, &head); dist, span, from, to, param, plen, &ret, &head);
if (rc == 0) { if (rc == 0) {
fprintf(stdout, "Test was added successfully\n"); fprintf(stdout, "Test was added successfully\n");
if (ret != 0) {
fprintf(stdout, "Server group contains userland test "
"nodes, old version of tcplnd can't accept "
"connection request\n");
}
goto out; goto out;
} }
...@@ -2931,6 +3065,8 @@ static command_t lst_cmdlist[] = { ...@@ -2931,6 +3065,8 @@ static command_t lst_cmdlist[] = {
{"stat", jt_lst_stat, NULL, {"stat", jt_lst_stat, NULL,
"Usage: lst stat [--bw] [--rate] [--read] [--write] [--max] [--min] [--avg] " "Usage: lst stat [--bw] [--rate] [--read] [--write] [--max] [--min] [--avg] "
" [--timeout #] [--delay #] GROUP [GROUP]" }, " [--timeout #] [--delay #] GROUP [GROUP]" },
{"show_error", jt_lst_show_error, NULL,
"Usage: lst show_error [--group NAME] | [--nodes IDS]" },
{"add_batch", jt_lst_add_batch, NULL, {"add_batch", jt_lst_add_batch, NULL,
"Usage: lst add_batch NAME" }, "Usage: lst add_batch NAME" },
{"run", jt_lst_start_batch, NULL, {"run", jt_lst_start_batch, NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment