Hello community, here is the log from the commit of package booth for openSUSE:Factory checked in at 2015-08-31 22:59:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/booth (Old) and /work/SRC/openSUSE:Factory/.booth.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "booth" Changes: -------- --- /work/SRC/openSUSE:Factory/booth/booth.changes 2015-08-05 06:51:53.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.booth.new/booth.changes 2015-08-31 22:59:50.000000000 +0200 @@ -1,0 +2,10 @@ +Mon Aug 31 12:55:06 UTC 2015 - dmuhamedagic@suse.com + +- Update to version v0.2.0_107_g3e73b68: + + booth-keygen: older dd don't have status=none option + + ticket: move election start out of the signal handler (bsc#942346) + + extprog: handle better multiple children signal delivery + + client: prevent garbage characters at the end of the list + + service-runnable: improve error checking + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.UIg6sO/_old 2015-08-31 22:59:51.000000000 +0200 +++ /var/tmp/diff_new_pack.UIg6sO/_new 2015-08-31 22:59:51.000000000 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/booth.git</param> - <param name="changesrevision">f79df7bd441a797da5fde8a7949334209bc7befe</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">3e73b683b36c38650d1d2ff4c9393cb1bb2056e6</param></service></servicedata> \ No newline at end of file ++++++ booth.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/.git_info new/booth/.git_info --- old/booth/.git_info 2015-08-03 17:38:16.000000000 +0200 +++ new/booth/.git_info 2015-08-31 14:53:31.000000000 +0200 @@ -1 +1 @@ -v0.2.0-97-gda68360 +v0.2.0-107-g3e73b68 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/script/booth-keygen new/booth/script/booth-keygen --- old/booth/script/booth-keygen 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/script/booth-keygen 2015-08-28 20:03:37.000000000 +0200 @@ -54,9 +54,10 @@ fi umask 077 -dd if=$RND_SRC of=$keyf bs=$KEYSIZE count=1 status=none +errout=`dd if=$RND_SRC of=$keyf bs=$KEYSIZE count=1 2>&1` rc=$? if [ $rc -ne 0 ]; then + echo "$errout" >&2 exit $rc fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/script/service-runnable new/booth/script/service-runnable --- old/booth/script/service-runnable 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/script/service-runnable 2015-08-28 20:03:37.000000000 +0200 @@ -5,14 +5,30 @@ # acquire the ticket here. service="${1:?Need a resource name as first argument.}" +if [ -z "$service" ]; then + ha_logger "$0: bad usage: no resource name" + exit 1 +fi tmpshadow=`mktemp booth-check.XXXXXX` +if [ $? -ne 0 -o ! -f "$tmpshadow" ]; then + ha_logger "$0: mktemp failed" + exit 1 +fi + trap "rm -f $tmpshadow" EXIT # We expect an output like # p_dummy (ocf::pacemaker:Dummy): Started geo-rz2-a -if crm_simulate -O $tmpshadow --ticket-grant "$BOOTH_TICKET" --simulate --live-check | +status=`crm_simulate -O $tmpshadow --ticket-grant "$BOOTH_TICKET" --simulate --live-check 2>&1` +if [ $? -ne 0 ]; then + ha_logger "$0: crm_simulate failed" + ha_logger "$0: crm_simulate: $status" + exit 1 +fi + +if echo "$status" | sed -n '/^Revised cluster status:/,$p' | egrep "^[[:space:]]+$service[[:space:]]+\(.*\):[[:space:]]+Started ([^[:space:]]+) *$" >/dev/null then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/config.c new/booth/src/config.c --- old/booth/src/config.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/config.c 2015-08-28 20:03:37.000000000 +0200 @@ -337,8 +337,8 @@ } /* make arguments for execv(2) - * tk->clu_test.prog points to the path - * tk->clu_test.argv is argument vector (starts with the prog) + * tk_test.prog points to the path + * tk_test.argv is argument vector (starts with the prog) * (strtok pokes holes in the configuration parameter value, i.e. * we don't need to allocate memory for arguments) */ @@ -347,24 +347,24 @@ char *p; int i = 0; - if (tk->clu_test.prog) { - free(tk->clu_test.prog); + if (tk_test.prog) { + free(tk_test.prog); } - if (!(tk->clu_test.prog = strdup(val))) { + if (!(tk_test.prog = strdup(val))) { log_error("out of memory"); return -1; } - p = strtok(tk->clu_test.prog, " \t"); - tk->clu_test.argv[i++] = p; + p = strtok(tk_test.prog, " \t"); + tk_test.argv[i++] = p; do { p = strtok(NULL, " \t"); if (i >= MAX_ARGS) { log_error("too many arguments for the acquire-handler"); - free(tk->clu_test.prog); + free(tk_test.prog); return -1; } - tk->clu_test.argv[i++] = p; + tk_test.argv[i++] = p; } while (p); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/config.h new/booth/src/config.h --- old/booth/src/config.h 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/config.h 2015-08-28 20:03:37.000000000 +0200 @@ -44,6 +44,8 @@ EXTPROG_IGNORE, } extprog_state_e; +#define tk_test tk->clu_test + struct ticket_config { /** \name Configuration items. * @{ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/handler.c new/booth/src/handler.c --- old/booth/src/handler.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/handler.c 2015-08-28 20:03:37.000000000 +0200 @@ -71,7 +71,7 @@ int rv = 0; pid_t pid; - if (!tk->clu_test.prog) + if (!tk_test.prog) return 0; switch(pid=fork()) { @@ -83,12 +83,12 @@ exit(1); } closefiles(); /* don't leak open files */ - execv(tk->clu_test.prog, tk->clu_test.argv); - tk_log_error("%s: execv failed (%s)", tk->clu_test.prog, strerror(errno)); + execv(tk_test.prog, tk_test.argv); + tk_log_error("%s: execv failed (%s)", tk_test.prog, strerror(errno)); exit(1); default: /* parent */ - tk->clu_test.pid = pid; - tk->clu_test.progstate = EXTPROG_RUNNING; + tk_test.pid = pid; + tk_test.progstate = EXTPROG_RUNNING; rv = RUNCMD_MORE; /* program runs */ } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/main.c new/booth/src/main.c --- old/booth/src/main.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/main.c 2015-08-28 20:03:37.000000000 +0200 @@ -717,7 +717,7 @@ goto out_close; } - data = malloc(data_len); + data = malloc(data_len+1); if (!data) { rv = -ENOMEM; goto out_free; @@ -726,7 +726,8 @@ if (rv < 0) goto out_free; - (void)fwrite(data, data_len, 1, stdout); + *(data + data_len) = '\0'; + (void)fputs(data, stdout); fflush(stdout); rv = 0; @@ -1407,31 +1408,24 @@ static void wait_child(int sig) { - int i, status, rv; + int i, status; struct ticket_config *tk; /* use waitpid(2) and not wait(2) in order not to interfear * with popen(2)/pclose(2) and system(2) used in pacemaker.c */ foreach_ticket(i, tk) { - if (tk->clu_test.prog && tk->clu_test.pid >= 0 && - (tk->clu_test.progstate == EXTPROG_RUNNING || - tk->clu_test.progstate == EXTPROG_IGNORE) && - waitpid(tk->clu_test.pid, &status, WNOHANG) == tk->clu_test.pid) { - if (tk->clu_test.progstate == EXTPROG_IGNORE) { + if (tk_test.prog && tk_test.pid >= 0 && + (tk_test.progstate == EXTPROG_RUNNING || + tk_test.progstate == EXTPROG_IGNORE) && + waitpid(tk_test.pid, &status, WNOHANG) == tk_test.pid) { + if (tk_test.progstate == EXTPROG_IGNORE) { /* not interested in the outcome */ - tk->clu_test.pid = 0; - tk->clu_test.progstate = EXTPROG_IDLE; - return; - } - tk->clu_test.status = status; - tk->clu_test.progstate = EXTPROG_EXITED; - if (tk->state != ST_LEADER) { - rv = acquire_ticket(tk, OR_ADMIN); - if (rv != 0) { /* external program failed */ - tk->outcome = rv; - foreach_tkt_req(tk, notify_client); - } + tk_test.pid = 0; + tk_test.progstate = EXTPROG_IDLE; + } else { + tk_test.status = status; + tk_test.progstate = EXTPROG_EXITED; } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/pacemaker.c new/booth/src/pacemaker.c --- old/booth/src/pacemaker.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/pacemaker.c 2015-08-28 20:03:37.000000000 +0200 @@ -281,7 +281,7 @@ rv = pclose(p); if (!rv) { log_debug("command \"%s\" value %" PRIi64, cmd, v); - } else if (rv == 6) { + } else if (WEXITSTATUS(rv) == 6) { log_info("command \"%s\", ticket not found", cmd); } else { log_error("command \"%s\" %s, value %" PRIi64, cmd, interpret_rv(rv), v); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/raft.c new/booth/src/raft.c --- old/booth/src/raft.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/raft.c 2015-08-28 20:03:37.000000000 +0200 @@ -97,7 +97,7 @@ { int duration; - tk_log_debug("updating from %s (%d/%d)", + tk_log_info("updating from %s (%d/%d)", site_string(sender), ntohl(msg->ticket.term), msg_term_time(msg)); duration = min(tk->term_duration, msg_term_time(msg)); @@ -222,8 +222,8 @@ tk->in_election = 0; new_leader = majority_votes(tk); if (new_leader == local) { - tk_log_info("granted successfully here"); won_elections(tk); + tk_log_info("granted successfully here"); } else if (new_leader) { tk_log_info("ticket granted at %s", site_string(new_leader)); @@ -507,7 +507,7 @@ if (tk->state != ST_CANDIDATE) { /* lost candidate status, somebody rejected our proposal */ - tk_log_debug("candidate status lost, ignoring vote_for from %s", + tk_log_info("candidate status lost, ignoring VtFr from %s", site_string(sender)); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/ticket.c new/booth/src/ticket.c --- old/booth/src/ticket.c 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/src/ticket.c 2015-08-28 20:03:37.000000000 +0200 @@ -196,7 +196,7 @@ /* immediately returned with success */ break; case RUNCMD_MORE: - tk_log_debug("forked %s", tk->clu_test.prog); + tk_log_debug("forked %s", tk_test.prog); break; default: break; @@ -210,7 +210,7 @@ { int rv = -1, status; - status = tk->clu_test.status; + status = tk_test.status; if (WIFEXITED(status)) { rv = WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { @@ -218,15 +218,15 @@ } if (rv) { tk_log_warn("handler \"%s\" failed: %s", - tk->clu_test.prog, interpret_rv(status)); + tk_test.prog, interpret_rv(status)); tk_log_warn("we are not allowed to acquire ticket"); ext_prog_failed(tk, start_election); } else { tk_log_debug("handler \"%s\" exited with success", - tk->clu_test.prog); + tk_test.prog); } - tk->clu_test.pid = 0; - tk->clu_test.progstate = EXTPROG_IDLE; + tk_test.pid = 0; + tk_test.progstate = EXTPROG_IDLE; return rv; } @@ -244,10 +244,10 @@ { int rv = 0; - if (!tk->clu_test.prog) + if (!tk_test.prog) return 0; - switch(tk->clu_test.progstate) { + switch(tk_test.progstate) { case EXTPROG_IDLE: rv = run_external_prog(tk, start_election); break; @@ -327,10 +327,10 @@ static void ignore_extprog(struct ticket_config *tk) { - if (tk->clu_test.prog && tk->clu_test.pid >= 0 && - tk->clu_test.progstate == EXTPROG_RUNNING) { - tk->clu_test.progstate = EXTPROG_IGNORE; - (void)kill(tk->clu_test.pid, SIGTERM); + if (tk_test.prog && tk_test.pid >= 0 && + tk_test.progstate == EXTPROG_RUNNING) { + tk_test.progstate = EXTPROG_IGNORE; + (void)kill(tk_test.pid, SIGTERM); } } @@ -528,7 +528,7 @@ if (sender) tk_log_info("ticket granted to %s (says %s)", site_string(tk->leader), - site_string(sender)); + tk->leader == sender ? "they" : site_string(sender)); else tk_log_info("ticket granted to %s (from CIB)", site_string(tk->leader)); @@ -615,9 +615,8 @@ } if ((cmd == CMD_REVOKE) && tk->leader != local) { - log_info("the ticket %s is not granted here, " - "redirect to %s", - msg->ticket.id, ticket_leader_string(tk)); + tk_log_info("not granted here, redirect to %s", + ticket_leader_string(tk)); rv = RLT_REDIRECT; goto reply_now; } @@ -804,7 +803,7 @@ int ack_cnt; if (++tk->retry_number > tk->retries) { - tk_log_debug("giving up on sending retries"); + tk_log_info("giving up on sending retries"); no_resends(tk); set_ticket_wakeup(tk); return; @@ -812,7 +811,7 @@ /* try to reach some sites again if we just stepped down */ if (tk->last_request == OP_VOTE_FOR) { - tk_log_warn("no answers to our request (try #%d), " + tk_log_warn("no answers to our VtFr request to step down (try #%d), " "we are alone", tk->retry_number); goto just_resend; @@ -850,10 +849,22 @@ static void process_next_state(struct ticket_config *tk) { + int rv; + switch(tk->next_state) { case ST_LEADER: - log_reacquire_reason(tk); - acquire_ticket(tk, OR_REACQUIRE); + if (has_extprog_exited(tk)) { + if (tk->state != ST_LEADER) { + rv = acquire_ticket(tk, OR_ADMIN); + if (rv != 0) { /* external program failed */ + tk->outcome = rv; + foreach_tkt_req(tk, notify_client); + } + } + } else { + log_reacquire_reason(tk); + acquire_ticket(tk, OR_REACQUIRE); + } break; case ST_INIT: no_resends(tk); @@ -892,12 +903,23 @@ static void next_action(struct ticket_config *tk) { + int rv; + switch(tk->state) { case ST_INIT: /* init state, handle resends for ticket revoke */ /* and rebroadcast if stepping down */ - if (tk->acks_expected) { - handle_resends(tk); + /* try to acquire ticket on grant */ + if (has_extprog_exited(tk)) { + rv = acquire_ticket(tk, OR_ADMIN); + if (rv != 0) { /* external program failed */ + tk->outcome = rv; + foreach_tkt_req(tk, notify_client); + } + } else { + if (tk->acks_expected) { + handle_resends(tk); + } } break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/test/live_test.sh new/booth/test/live_test.sh --- old/booth/test/live_test.sh 2015-08-03 17:01:03.000000000 +0200 +++ new/booth/test/live_test.sh 2015-08-28 20:03:37.000000000 +0200 @@ -172,7 +172,7 @@ stop_site_clean() { manage_site $1 stop && #sleep 1 && - runcmd $1 crm_ticket --force -t $tkt -r + runcmd $1 crm_ticket --force -t $tkt --cleanup > /dev/null } stop_site() { manage_site $1 stop @@ -271,6 +271,13 @@ done return 1 } +is_pacemaker_running() { + local h + for h in $sites; do + crmadmin -D >/dev/null || return 1 + done + return 0 +} sync_conf() { local h rc=0 for h in $sites $arbitrators; do @@ -342,6 +349,12 @@ runcmd $h $@ } +# need to get logs from _all_ clusters' nodes +get_all_nodes() { + for h in $sites; do + runcmd $h crm_node -l | awk '{print $2}' + done +} get_port() { grep "^port" | sed -n 's/.*="//;s/"//p' @@ -603,7 +616,7 @@ fi hb_report $hb_report_opts $quick_opt -f "`date -d @$((start_ts-5))`" \ -t "`date -d @$((end_ts+60))`" \ - -n "$sites $arbitrators" $name 2>&1 | logmsg + -n "$all_nodes $arbitrators" $name 2>&1 | logmsg } runtest() { local start_ts end_ts @@ -1076,9 +1089,14 @@ echo "ERROR: configuration file $cnf doesn't exist" usage 1 } +is_pacemaker_running || { + echo "ERROR: sites must run pacemaker" + exit 1 +} sites=`get_servers site < $cnf` arbitrators=`get_servers arbitrator < $cnf` +all_nodes=`get_all_nodes` port=`get_port < $cnf` : ${port:=9929} site_cnt=`echo $sites | wc -w`