# some defaults
DEBUG=2
LOGFD=${LOGFD:-1}
+LARGE_STRESS=${LARGE_STRESS:-}
# timeouts for polling the bkserver
timeout=10
echo " -j | --jobs-count Count of test(ed) jobs."
echo " -s | --states List of states in which could tested jobs fall."
echo " -p | --proxy-purge-states List of states in which LBProxy purges the job."
+ echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages."
+ echo " -g | --log 'logfile' Redirect all output to the 'logfile'."
echo ""
echo "For proper operation check your grid-proxy-info"
grid-proxy-info
{
# $LOGEV -j $EDG_JOBID -s NetworkServer -e UserTag --name color --value red
[ $DEBUG -gt 2 ] && echo "$LOGEV -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@"
- EDG_WL_SEQUENCE=`$LOGEV -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"`
+ EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"`
test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV"
}
# $LOGEV -x -j $EDG_JOBID -s NetworkServer -e UserTag --name color --value red
[ $DEBUG -gt 2 ] && echo "$LOGEV -x -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@"
- EDG_WL_SEQUENCE=`$LOGEV -x -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"`
+ EDG_WL_SEQUENCE=`$LOGEV -x $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"`
test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV"
}
[ $DEBUG -gt 0 ] && echo -n -e "Purging test jobs from db\t\t"
job=0
while [ $job -lt $JOBS_ARRAY_SIZE ] ; do
+ LARGE_STRESS=""
EDG_WL_SEQUENCE="UI=999999:NS=9999999999:WM=999999:BH=9999999999:JSS=999999:LM=999999:LRMS=999999:APP=999999"
# log_ev_proxy -e Clear --reason=PurgingDB
# purge_proxy
tmp=`echo $RANDOM % $st_count + 1 | bc`
state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z`
- source glite-lb-$state.sh -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null
+ source glite-lb-$state.sh $LARGE_STRESS -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null
[ $? -ne 0 ] && echo -e "ERROR\n\tglite-lb-$state.sh ${SAMPLE_JOBS_ARRAY[$job]} error!"
proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z`
purged=`echo $LBPROXY_PURGE_STATES | grep $state`
"-j" | "--jobs-count") shift; JOBS_ARRAY_SIZE=$1 ;;
"-s" | "--states") shift; STATES="$1" ;;
"-p" | "--proxy-purge-states") shift; LBPROXY_PURGE_STATES="$1" ;;
- "-l" | "--log") shift ; logfile=$1 ;;
+ "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;;
+ "-g" | "--log") shift ; logfile=$1 ;;
*) echo "Unrecognized option $1" ;;
#define sizofa(a) (sizeof(a)/sizeof((a)[0]))
-int debug = 0;
-static const int one = 1;
-static char *dbstring = NULL;
-static char sock_store[PATH_MAX],
- sock_serve[PATH_MAX];
-static int slaves = 10,
- semaphores = -1,
- semset;
+int debug = 0;
+static const int one = 1;
+static char *dbstring = NULL;
+static char sock_store[PATH_MAX],
+ sock_serve[PATH_MAX];
+static int slaves = 10,
+ semaphores = -1,
+ semset;
+static char host[300];
+static char * port;
static struct option opts[] = {
if (semop(semset,&s,1) == -1) { perror("semop()"); return 1; }
}
+ gethostname(host, sizeof host);
+ host[sizeof host - 1] = 0;
+ asprintf(&port, "%d", GLITE_WMSC_JOBID_DEFAULT_PORT);
+ dprintf(("server address: %s:%d\n", host, port));
+
service_table[SRV_SERVE].conn = socket(PF_UNIX, SOCK_STREAM, 0);
if ( service_table[SRV_SERVE].conn < 0 ) { perror("socket()"); return 1; }
memset(&a, 0, sizeof(a));
/* Just check the database and let it be. The slaves do the job. */
- /* XXX: InitContextProxy() !!!
- * edg_wll_InitContext(&ctx) causes segfault
- */
+ edg_wll_InitContext(&ctx);
+ /* XXX: obsolete
+ * edg_wll_InitContext(&ctx) used to cause segfault
if ( !(ctx = (edg_wll_Context) malloc(sizeof(*ctx))) ) {
perror("InitContext()");
return -1;
}
memset(ctx, 0, sizeof(*ctx));
+ */
wait_for_open(ctx, dbstring);
if (edg_wll_DBCheckVersion(ctx)) {
char *et,*ed;
glite_srvbones_run(clnt_data_init, service_table, sizofa(service_table), debug);
-
semctl(semset, 0, IPC_RMID, 0);
unlink(pidfile);
for ( i = 0; i < sizofa(service_table); i++ )
if ( service_table[i].conn >= 0 ) close(service_table[i].conn);
unlink(sock_serve);
unlink(sock_store);
-
+ if (port) free(port);
return 0;
}
struct timeval total_to = { TOTAL_CLNT_TIMEOUT,0 },
conn_start, now;
-
if ( !(ctx = (edg_wll_Context) calloc(1, sizeof(*ctx))) ) {
fprintf(stderr, "Couldn't create context");
return -1;
ctx->p_tmp_timeout.tv_usec = total_to.tv_usec;
}
+ ctx->srvName = strdup(host);
+ ctx->srvPort = atoi(port);
+
ctx->connProxy = (edg_wll_ConnProxy *) calloc(1, sizeof(edg_wll_ConnProxy));
if ( !ctx->connProxy ) {
perror("calloc");