** Changed in: fuel
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
High Availability Team, which is subscribed to corosync in Ubuntu.
https://bugs.launchpad.net/bugs/1340172

Title:
  [OSCI] Add mamange/unmanage blocks to corosync init scripts

Status in Fuel for OpenStack:
  Fix Released
Status in corosync package in Ubuntu:
  Triaged

Bug description:
  Please add manage and unmanage fucntions to corosync init scripts'
  restart actions for both Centos and Ubuntu

  
  Here is patch for centos

  ====================================================================
  --- corosync-1.4.6/init/generic.in    2013-05-29 18:33:27.000000000 +0400
  +++ corosync-1.4.6.new/init/generic.in        2014-07-10 16:34:27.127641857 
+0400
  @@ -70,6 +70,50 @@
                   pidof -c -o $$ -o $PPID -o %PPID "${1##*/}"
   }
   
  +pcmk_maintance() {
  +  which cibadmin 1>/dev/null 2>/dev/null
  +
  +  if [ "${?}" -gt "0" ]; then
  +    return 0
  +  fi
  +
  +  pcmk_retry="30"
  +  pcmk_maintance="${1}"
  +  pcmk_sleep="1"
  +
  +  if [ "${pcmk_maintance}" = "" ]; then
  +    pcmk_maintance="true"
  +  fi
  +
  +  while [ "${pcmk_retry}" -gt "0" ]; do
  +    cat <<EOF | cibadmin --patch --sync-call --xml-pipe
  +
  +<diff>
  +  <diff-added>
  +    <cib>
  +      <configuration>
  +        <crm_config>
  +          <cluster_property_set id="cib-bootstrap-options">
  +            <nvpair id="cib-bootstrap-options-maintenance-mode" 
name="maintenance-mode" value="${pcmk_maintance}"/>
  +          </cluster_property_set>
  +        </crm_config>
  +      </configuration>
  +    </cib>
  +  </diff-added>
  +</diff>
  +EOF
  +
  +    if [ "${?}" -eq "0" ]; then
  +      break
  +    fi
  +
  +    echo "Pacemaker connection failed! Retries left: ${pcmk_retry}"
  +    pcmk_retry="$((pcmk_retry - 1))"
  +    sleep "${pcmk_sleep}"
  +
  +  done
  +}
  +
   cluster_disabled_at_boot()
   {
          if grep -q nocluster /proc/cmdline && \
  @@ -150,8 +194,13 @@
   
   restart()
   {
  +     status $prog
  +     if [ $? -eq 0 ]; then
  +             pcmk_maintance true
  +     fi
        stop
        start
  +     pcmk_maintance false
   }
   
   rtrn=0
  =======================================================

  
  And patch for ubuntu

  
  =======================================================
  --- debian/corosync.init      2011-08-24 11:27:27.000000000 +0400
  +++ debian.new/corosync.init  2014-07-10 16:47:12.823624121 +0400
  @@ -39,6 +39,50 @@
   # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
   . /lib/lsb/init-functions
   
  +pcmk_maintance() {
  +  which cibadmin 1>/dev/null 2>/dev/null
  +
  +  if [ "${?}" -gt "0" ]; then
  +    return 0
  +  fi
  +
  +  pcmk_retry="30"
  +  pcmk_maintance="${1}"
  +  pcmk_sleep="1"
  +
  +  if [ "${pcmk_maintance}" = "" ]; then
  +    pcmk_maintance="true"
  +  fi
  +
  +  while [ "${pcmk_retry}" -gt "0" ]; do
  +    cat <<EOF | cibadmin --patch --sync-call --xml-pipe
  +
  +<diff>
  +  <diff-added>
  +    <cib>
  +      <configuration>
  +        <crm_config>
  +          <cluster_property_set id="cib-bootstrap-options">
  +            <nvpair id="cib-bootstrap-options-maintenance-mode" 
name="maintenance-mode" value="${pcmk_maintance}"/>
  +          </cluster_property_set>
  +        </crm_config>
  +      </configuration>
  +    </cib>
  +  </diff-added>
  +</diff>
  +EOF
  +
  +    if [ "${?}" -eq "0" ]; then
  +      break
  +    fi
  +
  +    echo "Pacemaker connection failed! Retries left: ${pcmk_retry}"
  +    pcmk_retry="$((pcmk_retry - 1))"
  +    sleep "${pcmk_sleep}"
  +
  +  done
  +}
  +
   #
   # Function that starts the daemon/service
   #
  @@ -95,6 +139,10 @@
        ;;
     restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
  +     status_of_proc -p $PIDFILE $DAEMON $NAME
  +     if [ $? -eq 0 ]; then
  +             pcmk_maintance true
  +     fi
        do_stop
        case "$?" in
          0|1)
  @@ -104,6 +152,8 @@
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
  +             sleep 1
  +             pcmk_maintance false
                ;;
          *)
                # Failed to stop
  =======================================================

To manage notifications about this bug go to:
https://bugs.launchpad.net/fuel/+bug/1340172/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~ubuntu-ha
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~ubuntu-ha
More help   : https://help.launchpad.net/ListHelp

Reply via email to