This commit was manufactured by cvs2svn to create branch 'glite-lb-
authorcvs2svn <admin@example.com>
Sat, 15 Oct 2005 04:58:42 +0000 (04:58 +0000)
committercvs2svn <admin@example.com>
Sat, 15 Oct 2005 04:58:42 +0000 (04:58 +0000)
proxy_branch_1_2_0_RC15'.

Sprout from glite-lb-proxy_branch_1_2_0_2 2005-09-02 12:17:42 UTC cvs2svn <admin@example.com> 'This commit was manufactured by cvs2svn to create branch 'glite-lb-'
Cherrypick from master 2005-10-15 04:58:37 UTC Master Builder <glbuilder@cern.ch> 'Incremented build number [GLBUILDER]':
    org.glite.lb.proxy/examples/test.sh
    org.glite.lb.proxy/project/build.number
    org.glite.lb.proxy/src/lbproxy.c

org.glite.lb.proxy/examples/test.sh
org.glite.lb.proxy/project/build.number
org.glite.lb.proxy/src/lbproxy.c

index 4822ba5..31fc184 100755 (executable)
@@ -28,6 +28,7 @@ SAMPLE_JOBS_RESPONSES[0]=
 # some defaults
 DEBUG=2
 LOGFD=${LOGFD:-1}
+LARGE_STRESS=${LARGE_STRESS:-}
 
 # timeouts for polling the bkserver
 timeout=10
@@ -47,6 +48,8 @@ show_help()
        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
@@ -75,7 +78,7 @@ log_ev()
 {
 #      $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"
 }
 
@@ -84,7 +87,7 @@ log_ev_proxy()
 #      $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"
 }
 
@@ -106,6 +109,7 @@ db_clear_jobs()
        [ $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
@@ -169,7 +173,7 @@ test_logging_events()
                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`
@@ -236,7 +240,8 @@ do
        "-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" ;;
 
index 6505362..8e91e0d 100644 (file)
@@ -1 +1,2 @@
-module.build=2
+#Sat Oct 15 06:58:34 CEST 2005
+module.build=10
index 398b732..3110076 100644 (file)
@@ -69,14 +69,16 @@ extern char *lbproxy_ilog_file_prefix;
 #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[] = {
@@ -211,6 +213,11 @@ int main(int argc, char *argv[])
                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));
@@ -265,14 +272,15 @@ int main(int argc, char *argv[])
 
 
        /* 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;
@@ -307,14 +315,13 @@ int main(int argc, char *argv[])
 
        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;
 }
@@ -349,7 +356,6 @@ int handle_conn(int conn, struct timeval *timeout, void *data)
        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;
@@ -376,6 +382,9 @@ int handle_conn(int conn, struct timeval *timeout, void *data)
                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");