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

Bug #1340172 reported by Dmitry Ilyin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
High
Vitaly Parakhin
corosync (Ubuntu)
Won't Fix
Undecided
Unassigned
Precise
Won't Fix
Undecided
Unassigned

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
=======================================================

Dmitry Ilyin (idv1985)
Changed in fuel:
importance: Undecided → Medium
assignee: nobody → Roman Vyalov (r0mikiam)
Roman Vyalov (r0mikiam)
Changed in fuel:
assignee: Roman Vyalov (r0mikiam) → Fuel OSCI Team (fuel-osci)
status: New → Confirmed
Revision history for this message
Roman Vyalov (r0mikiam) wrote :
Revision history for this message
OSCI Robot (oscirobot) wrote :

Package corosync has been built from changeset: http://gerrit.mirantis.com/18280
RPM Repository URL: http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable-18280/centos
You can build an ISO with this package:
make iso EXTRA_RPM_REPOS="osci-testing,http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable-18280/centos"

Changed in fuel:
status: Confirmed → In Progress
Dmitry Ilyin (idv1985)
summary: - Add mamange/unmanage blocks to corosync init scripts
+ [OSCI] Add mamange/unmanage blocks to corosync init scripts
Revision history for this message
OSCI Robot (oscirobot) wrote :

Package corosync has been built from changeset: http://gerrit.mirantis.com/18280
RPM Repository URL: http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable-18280/centos
You can build an ISO with this package:
make iso EXTRA_RPM_REPOS="osci-testing,http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable-18280/centos"

Revision history for this message
OSCI Robot (oscirobot) wrote :

Package corosync has been built from changeset: http://gerrit.mirantis.com/18289
DEB Repository URL: http://osci-obs.vm.mirantis.net:82/ubuntu-fuel-5.1-stable-18289/ubuntu
You can build an ISO with this package:
make iso EXTRA_DEB_REPOS="http://osci-obs.vm.mirantis.net:82/ubuntu-fuel-5.1-stable-18289/ubuntu /"

Changed in fuel:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Changed in fuel:
assignee: Fuel OSCI Team (fuel-osci) → Vitaly Parakhin (vparakhin)
Roman Vyalov (r0mikiam)
Changed in fuel:
importance: Medium → High
Revision history for this message
OSCI Robot (oscirobot) wrote :

Package corosync has been built from changeset: http://gerrit.mirantis.com/18280
RPM Repository URL: http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable/centos
You can build an ISO with this package:
make iso EXTRA_RPM_REPOS="osci-testing,http://osci-obs.vm.mirantis.net:82/centos-fuel-5.1-stable/centos"

Revision history for this message
OSCI Robot (oscirobot) wrote :

Package corosync has been built from changeset: http://gerrit.mirantis.com/18289
DEB Repository URL: http://osci-obs.vm.mirantis.net:82/ubuntu-fuel-5.1-stable/ubuntu
You can build an ISO with this package:
make iso EXTRA_DEB_REPOS="http://osci-obs.vm.mirantis.net:82/ubuntu-fuel-5.1-stable/ubuntu /"

Revision history for this message
Vitaly Parakhin (vparakhin) wrote :

fix is on mirrors

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Andrew Beekhof (1nbr3w) wrote :

Any reason not to use crm_attribute instead of piping a diff into cibadmin?
crm_attribute is able to be a bit smarter (eg. when such an setting already exists somewhere else) which might things less fragile.

James Page (james-page)
tags: added: mos
James Page (james-page)
Changed in corosync (Ubuntu):
importance: Undecided → High
tags: added: openstack
Changed in corosync (Ubuntu):
status: New → Triaged
Changed in fuel:
status: Fix Committed → Fix Released
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Reviewing cases for the Ubuntu HA effort. Marked as ubuntu-ha.

Changed in corosync (Ubuntu):
assignee: nobody → Rafael David Tinoco (rafaeldtinoco)
tags: added: ubuntu-ha
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Thank you for taking the time to report this bug. In an effort to keep an
up-to-date and valid list of bugs to work on, I have reviewed this report
to verify it still requires effort and occurs on an Ubuntu release in
standard support, and it does not.

Unfortunately this bug is old for us to consider having an sysv-compatible
option to put the cluster into maintenance mode. Corosync is also being managed,
for sometime now, by systemd so this particular change wouldn't make much sense.
IMHO this type of cluster change should be done by the cluster administrator in
specific tools like crmsh, pcs, and not in an init script.

It is unfortunate that we were unable to resolve this defect, however
there appears to be no further action possible at this time. I am
therefore moving the bug to 'Incomplete'. If you disagree or have
new information, we would be grateful if you could please add a comment
stating why and then change the status of the bug to 'New'.

Changed in corosync (Ubuntu Precise):
status: New → Incomplete
Changed in corosync (Ubuntu):
status: Triaged → Won't Fix
assignee: Rafael David Tinoco (rafaeldtinoco) → nobody
Changed in corosync (Ubuntu Precise):
status: Incomplete → Won't Fix
Changed in corosync (Ubuntu):
importance: High → Undecided
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers