Hello community, here is the log from the commit of package cluster-glue for openSUSE:Factory checked in at 2015-05-20 23:23:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cluster-glue (Old) and /work/SRC/openSUSE:Factory/.cluster-glue.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cluster-glue" Changes: -------- --- /work/SRC/openSUSE:Factory/cluster-glue/cluster-glue.changes 2015-03-01 14:49:39.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.cluster-glue.new/cluster-glue.changes 2015-05-20 23:23:09.000000000 +0200 @@ -1,0 +2,12 @@ +Mon May 11 08:24:10 UTC 2015 - [email protected] + +- Low: stonith: external/ec2: update name in the short description +- High: stonith: external/ec2: new agent for aws/ec2 +- Medium: hb_report: use faster zypper interface if available +- Medium: stonith: external/vcenter: replace experimental smartmatch (bnc#900353) +- Medium: ha_logd: prevent race caused by pid reuse (bsc#894272) +- fix syslogmsgfmt logging inconsistency for stderr/stdout +- Medium: clplumbing: don't abort on bad input +- upstream cs: 9da0680bc9c0 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cluster-glue.spec ++++++ --- /var/tmp/diff_new_pack.OlkHGK/_old 2015-05-20 23:23:09.000000000 +0200 +++ /var/tmp/diff_new_pack.OlkHGK/_new 2015-05-20 23:23:09.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package cluster-glue # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed ++++++ cluster-glue.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/.hg_archival.txt new/cluster-glue/.hg_archival.txt --- old/cluster-glue/.hg_archival.txt 2014-10-31 15:43:17.000000000 +0100 +++ new/cluster-glue/.hg_archival.txt 2015-03-11 13:24:25.000000000 +0100 @@ -1,5 +1,6 @@ repo: e3ffdd7ae81c596b2be7e1e110d2c1255161340e -node: 6be50bc2ce61d9ac64e591c97609cace06ce3045 +node: 9da0680bc9c0b99eba65b40aac9282a8dd28889a branch: default latesttag: glue-1.0.12 -latesttagdistance: 5 +latesttagdistance: 13 +changessincelatesttag: 13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/hb_report/hb_report.in new/cluster-glue/hb_report/hb_report.in --- old/cluster-glue/hb_report/hb_report.in 2014-10-31 15:43:17.000000000 +0100 +++ new/cluster-glue/hb_report/hb_report.in 2015-03-11 13:24:25.000000000 +0100 @@ -67,7 +67,7 @@ usage() { cat<<EOF -usage: hb_report -f {time|"cts:"testnum} [-t time] +usage: $PROG -f {time|"cts:"testnum} [-t time] [-u user] [-X ssh-options] [-l file] [-n nodes] [-E files] [-p patt] [-L patt] [-e prog] [-MSDZAQVsvhd] [dest] @@ -117,12 +117,12 @@ Examples - hb_report -f 2pm report_1 - hb_report -f "2007/9/5 12:30" -t "2007/9/5 14:00" report_2 - hb_report -f 1:00 -t 3:00 -l /var/log/cluster/ha-debug report_3 - hb_report -f "09sep07 2:00" -u hbadmin report_4 - hb_report -f 18:00 -p "usern.*" -p "admin.*" report_5 - hb_report -f cts:133 ctstest_133 + $PROG -f 2pm report_1 + $PROG -f "2007/9/5 12:30" -t "2007/9/5 14:00" report_2 + $PROG -f 1:00 -t 3:00 -l /var/log/cluster/ha-debug report_3 + $PROG -f "09sep07 2:00" -u hbadmin report_4 + $PROG -f 18:00 -p "usern.*" -p "admin.*" report_5 + $PROG -f cts:133 ctstest_133 . WARNING . WARNING . WARNING . WARNING . WARNING . WARNING . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/hb_report/utillib.sh new/cluster-glue/hb_report/utillib.sh --- old/cluster-glue/hb_report/utillib.sh 2014-10-31 15:43:17.000000000 +0100 +++ new/cluster-glue/hb_report/utillib.sh 2015-03-11 13:24:25.000000000 +0100 @@ -387,6 +387,10 @@ local pkg debug "get debuginfo packages using zypper: $@" zypper -qn ref > /dev/null + # use --ignore-unknown if available, much faster + # (2 is zypper exit code for syntax/usage) + zypper -qn --ignore-unknown install -C $@ >/dev/null + [ $? -ne 2 ] && return for pkg in $@; do zypper -qn install -C $pkg >/dev/null done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/lib/plugins/stonith/external/Makefile.am new/cluster-glue/lib/plugins/stonith/external/Makefile.am --- old/cluster-glue/lib/plugins/stonith/external/Makefile.am 2014-10-31 15:43:17.000000000 +0100 +++ new/cluster-glue/lib/plugins/stonith/external/Makefile.am 2015-03-11 13:24:25.000000000 +0100 @@ -28,6 +28,6 @@ ext_SCRIPTS = drac5 dracmc-telnet ibmrsa ibmrsa-telnet ipmi riloe ssh vmware vcenter rackpdu xen0 hmchttp \ xen0-ha kdumpcheck ippower9258 nut libvirt \ - hetzner + hetzner ec2 helper_SCRIPTS = xen0-ha-dom0-stonith-helper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/lib/plugins/stonith/external/ec2 new/cluster-glue/lib/plugins/stonith/external/ec2 --- old/cluster-glue/lib/plugins/stonith/external/ec2 1970-01-01 01:00:00.000000000 +0100 +++ new/cluster-glue/lib/plugins/stonith/external/ec2 2015-03-11 13:24:25.000000000 +0100 @@ -0,0 +1,405 @@ +#!/bin/bash + +description=" +fence_ec2 is an I/O Fencing agent which can be used with Amazon EC2 instances. + +API functions used by this agent: +- aws ec2 describe-tags +- aws ec2 describe-instances +- aws ec2 stop-instances +- aws ec2 start-instances +- aws ec2 reboot-instances + +If the uname used by the cluster node is any of: + - Public DNS name (or part there of), + - Private DNS name (or part there of), + - Instance ID (eg. i-4f15a839) + - Contents of tag associated with the instance +then the agent should be able to automatically discover the instances it can control. + +If the tag containing the uname is not [Name], then it will need to be specified using the [tag] option. +" + +# +# Copyright (c) 2011-2013 Andrew Beekhof +# Copyright (c) 2014 NIPPON TELEGRAPH AND TELEPHONE CORPORATION +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +####################################################################### + +quiet=0 +port_default="" + +instance_not_found=0 +unknown_are_stopped=0 + +action_default="reset" # Default fence action +ec2_tag_default="Name" # EC2 Tag containing the instance's uname + +sleep_time="1" + +ec2_tag=${tag} + +: ${ec2_tag=${ec2_tag_default}} +: ${port=${port_default}} + +function usage() +{ +cat <<EOF +`basename $0` - A fencing agent for Amazon EC2 instances + +$description + +Usage: `basename $0` -o|--action [-n|--port] [options] +Options: + -h, --help This text + -V, --version Version information + -q, --quiet Reduced output mode + +Commands: + -o, --action Action to perform: on|off|reboot|status|monitor + -n, --port The name of a machine/instance to control/check + +Additional Options: + -p, --profile Use a specific profile from your credential file. + -t, --tag Name of the tag containing the instance's uname + +Dangerous options: + -U, --unknown-are-stopped Assume any unknown instance is safely stopped + +EOF + exit 0; +} + +function getinfo_xml() +{ + cat <<EOF +<parameters> + <parameter name="port" unique="1" required="1"> + <content type="string" /> + <shortdesc lang="en">The name/id/tag of a instance to control/check</shortdesc> + </parameter> + <parameter name="profile" unique="0" required="0"> + <content type="string" default="default" /> + <shortdesc lang="en">Use a specific profile from your credential file.</shortdesc> + </parameter> + <parameter name="tag" unique="0" required="1"> + <content type="string" default="Name" /> + <shortdesc lang="en">Name of the tag containing the instances uname</shortdesc> + </parameter> + <parameter name="unknown_are_stopped" unique="0" required="0"> + <content type="string" default="false" /> + <shortdesc lang="en">DANGER: Assume any unknown instance is safely stopped</shortdesc> + </parameter> +</parameters> +EOF + exit 0; +} + +function metadata() +{ + cat <<EOF +<?xml version="1.0" ?> +<resource-agent name="fence_ec2" shortdesc="Fencing agent for Amazon EC2 instances" > + <longdesc> +$description + </longdesc> + <parameters> + <parameter name="action" unique="0" required="1"> + <getopt mixed="-o, --action=[action]" /> + <content type="string" default="reboot" /> + <shortdesc lang="en">Fencing Action</shortdesc> + </parameter> + <parameter name="port" unique="1" required="1"> + <getopt mixed="-n, --port=[port]" /> + <content type="string" /> + <shortdesc lang="en">The name/id/tag of a instance to control/check</shortdesc> + </parameter> + <parameter name="profile" unique="0" required="0"> + <getopt mixed="-p, --profile=[profile]" /> + <content type="string" default="default" /> + <shortdesc lang="en">Use a specific profile from your credential file.</shortdesc> + </parameter> + <parameter name="tag" unique="0" required="1"> + <getopt mixed="-t, --tag=[tag]" /> + <content type="string" default="Name" /> + <shortdesc lang="en">Name of the tag containing the instances uname</shortdesc> + </parameter> + <parameter name="unknown-are-stopped" unique="0" required="0"> + <getopt mixed="-U, --unknown-are-stopped" /> + <content type="string" default="false" /> + <shortdesc lang="en">DANGER: Assume any unknown instance is safely stopped</shortdesc> + </parameter> + </parameters> + <actions> + <action name="on" /> + <action name="off" /> + <action name="reboot" /> + <action name="status" /> + <action name="list" /> + <action name="monitor" /> + <action name="metadata" /> + </actions> +</resource-agent> +EOF + exit 0; +} + +function instance_for_port() +{ + local port=$1 + local instance="" + + # Look for port name -n in the INSTANCE data + instance=`aws ec2 describe-instances $options | grep "^INSTANCES[[:space:]].*[[:space:]]$port[[:space:]]" | awk '{print $8}'` + if [ -z $instance ]; then + # Look for port name -n in the Name TAG + instance=`aws ec2 describe-tags $options | grep "^TAGS[[:space:]]$ec2_tag[[:space:]].*[[:space:]]instance[[:space:]]$port$" | awk '{print $3}'` + fi + + if [ -z $instance ]; then + instance_not_found=1 + instance=$port + fi + + echo $instance +} + +function instance_on() +{ + aws ec2 start-instances $options --instance-ids $instance +} + +function instance_off() +{ + if [ "$unknown_are_stopped" = 1 -a $instance_not_found ]; then + : nothing to do + ha_log.sh info "Assuming unknown instance $instance is already off" + else + aws ec2 stop-instances $options --instance-ids $instance --force + fi +} + +function instance_status() +{ + local instance=$1 + local status="unknown" + local rc=1 + + # List of instances and their current status + if [ "$unknown_are_stopped" = 1 -a $instance_not_found ]; then + ha_log.sh info "$instance stopped (unknown)" + else + status=`aws ec2 describe-instances $options --instance-ids $instance | awk '{ + if (/^STATE\t/) { printf "%s", $3 } + }'` + rc=$? + fi + ha_log.sh info "status check for $instance is $status" + echo $status + return $rc +} + + +TEMP=`getopt -o qVho:e:p:n:t:U --long version,help,action:,port:,option:,profile:,tag:,quiet,unknown-are-stopped \ + -n 'fence_ec2' -- "$@"` + +if [ $? != 0 ];then + usage + exit 1 +fi + +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" + +if [ -z $1 ]; then + # If there are no command line args, look for options from stdin + while read line; do + case $line in + option=*|action=*) action=`echo $line | sed s/.*=//`;; + port=*) port=`echo $line | sed s/.*=//`;; + profile=*) ec2_profile=`echo $line | sed s/.*=//`;; + tag=*) ec2_tag=`echo $line | sed s/.*=//`;; + quiet*) quiet=1;; + unknown-are-stopped*) unknown_are_stopped=1;; + --);; + *) ha_log.sh err "Invalid command: $line";; + esac + done +fi + +while true ; do + case "$1" in + -o|--action|--option) action=$2; shift; shift;; + -n|--port) port=$2; shift; shift;; + -p|--profile) ec2_profile=$2; shift; shift;; + -t|--tag) ec2_tag=$2; shift; shift;; + -U|--unknown-are-stopped) unknown_are_stopped=1; shift;; + -q|--quiet) quiet=1; shift;; + -V|--version) echo "1.0.0"; exit 0;; + --help|-h) + usage; + exit 0;; + --) shift ; break ;; + *) ha_log.sh err "Unknown option: $1. See --help for details."; exit 1;; + esac +done + +[ -n "$1" ] && action=$1 + +if [ -z "$ec2_profile"]; then + options="--output text --profile default" +else + options="--output text --profile $ec2_profile " +fi + +action=`echo $action | tr 'A-Z' 'a-z'` + +case $action in + metadata) + metadata + ;; + getinfo-xml) + getinfo_xml + ;; + getconfignames) + for i in profile port tag unknown_are_stopped + do + echo $i + done + exit 0 + ;; + getinfo-devid) + echo "EC2 STONITH device" + exit 0 + ;; + getinfo-devname) + echo "EC2 STONITH external device" + exit 0 + ;; + getinfo-devdescr) + echo "ec2 is an I/O Fencing agent which can be used with Amazon EC2 instances." + exit 0 + ;; + getinfo-devurl) + echo "" + exit 0 + ;; +esac + +# get my instance id +myinstance=`curl http://169.254.169.254/latest/meta-data/instance-id` + +# check my status. +# When the EC2 instance be stopped by the "aws ec2 stop-instances" , the stop processing of the OS is executed. +# While the OS stop processing, Pacemaker can execute the STONITH processing. +# So, If my status is not "running", it determined that I was already fenced. And to prevent fencing each other +# in split-brain, I don't fence other node. +if [ -z "$myinstance" ]; then + ha_log.sh err "Failed to get My Instance ID. so can not check my status." + exit 1 +fi +mystatus=`instance_status $myinstance` +if [ "$mystatus" != "running" ]; then #do not fence + ha_log.sh warn "I was already fenced (My instance status=$mystatus). I don't fence other node." + exit 1 +fi + +# get target's instance id +instance="" +if [ ! -z "$port" ]; then + instance=`instance_for_port $port $options` +fi + +case $action in + reboot|reset) + status=`instance_status $instance` + if [ "$status" != "stopped" ]; then + instance_off + fi + while true; + do + status=`instance_status $instance` + if [ "$status" = "stopped" ]; then + break + fi + sleep $sleep_time + done + instance_on + while true; + do + status=`instance_status $instance` + if [ "$status" = "running" ]; then + break + fi + sleep $sleep_time + done + ;; + poweron|on) + instance_on + while true; + do + status=`instance_status $instance` + if [ "$status" = "running" ]; then + break + fi + done + ;; + poweroff|off) + instance_off + while true; + do + status=`instance_status $instance` + if [ "$status" = "stopped" ]; then + break + fi + sleep $sleep_time + done + ;; + monitor) + # Is the device ok? + aws ec2 describe-instances $options | grep INSTANCES &> /dev/null + ;; + gethosts|hostlist|list) + # List of names we know about + a=`aws ec2 describe-instances $options | awk -v tag_pat="^TAGS\t$ec2_tag\t" -F '\t' '{ + if (/^INSTANCES/) { printf "%s\n", $8 } + else if ( $1"\t"$2"\t" ~ tag_pat ) { printf "%s\n", $3 } + }' | sort -u` + echo $a + ;; + stat|status) + instance_status $instance > /dev/null + ;; + *) ha_log.sh err "Unknown action: $action"; exit 1;; +esac + +status=$? + +if [ $quiet -eq 1 ]; then + : nothing +elif [ $status -eq 0 ]; then + ha_log.sh info "Operation $action passed" +else + ha_log.sh err "Operation $action failed: $status" +fi +exit $status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cluster-glue/lib/plugins/stonith/external/vcenter new/cluster-glue/lib/plugins/stonith/external/vcenter --- old/cluster-glue/lib/plugins/stonith/external/vcenter 2014-10-31 15:43:17.000000000 +0100 +++ new/cluster-glue/lib/plugins/stonith/external/vcenter 2015-03-11 13:24:25.000000000 +0100 @@ -31,7 +31,7 @@ my $command = $ARGV[0] || dielog("No command specified\n"); # Command belongs to the group of commands that do not require any connection to VMware vCenter -if ($command ~~ @configCommands) { +if (grep /^\Q$command\E$/, @configCommands) { if ($command eq "getconfignames") { print "VI_SERVER\nVI_PORTNUMBER\nVI_PROTOCOL\nVI_SERVICEPATH\nVI_CREDSTORE\nHOSTLIST\nRESETPOWERON\n"; } @@ -122,7 +122,7 @@ } # Command belongs to the group of commands that require connecting to VMware vCenter -elsif ($command ~~ @netCommands) { +elsif (grep /^\Q$command\E$/, @netCommands) { eval { require VMware::VIRuntime; } or dielog("Missing perl module VMware::VIRuntime. Download and install 'VMware Infrastructure (VI) Perl Toolkit', available at http://www.vmware.com/support/developer/viperltoolkit/ \n"); @@ -159,7 +159,7 @@ } # Command belongs to the group of commands that performs actions on Virtual Machines - if ($command ~~ @actionCommands) { + if (grep /^\Q$command\E$/, @actionCommands) { my $targetHost = $ARGV[1] || dielog("No target specified\n");
