[pve-devel] [RFC corosync-pve 3/5] add patches ensuring smooth upgrades from PVE 4.x

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Mar 8 14:22:07 CET 2017


Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 .../0001-add-Provides-Replaces-corosync-pve.patch  |  41 ++++++
 .../0002-don-t-install-default-corosync.conf.patch | 146 +++++++++++++++++++++
 ...restart-after-package-upgrade-is-complete.patch |  30 +++++
 patches/0004-remove-init-script.patch              | 145 ++++++++++++++++++++
 ...c-pve-postinst-for-restart-on-dist-upgrad.patch |  35 +++++
 patches/series                                     |   5 +
 6 files changed, 402 insertions(+)
 create mode 100644 patches/0001-add-Provides-Replaces-corosync-pve.patch
 create mode 100644 patches/0002-don-t-install-default-corosync.conf.patch
 create mode 100644 patches/0003-restart-after-package-upgrade-is-complete.patch
 create mode 100644 patches/0004-remove-init-script.patch
 create mode 100644 patches/0005-add-corosync-pve-postinst-for-restart-on-dist-upgrad.patch
 create mode 100644 patches/series

diff --git a/patches/0001-add-Provides-Replaces-corosync-pve.patch b/patches/0001-add-Provides-Replaces-corosync-pve.patch
new file mode 100644
index 0000000..3e07878
--- /dev/null
+++ b/patches/0001-add-Provides-Replaces-corosync-pve.patch
@@ -0,0 +1,41 @@
+From 60055d6619687705a248bf3ff0f7e09bf2da488c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Tue, 7 Mar 2017 13:29:31 +0100
+Subject: [PATCH 1/5] add Provides/Replaces: corosync-pve
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ debian/control | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/debian/control b/debian/control
+index fad5635..d11dc18 100644
+--- a/debian/control
++++ b/debian/control
+@@ -31,6 +31,11 @@ Homepage: http://corosync.github.io/corosync/
+ Vcs-Git: https://anonscm.debian.org/git/debian-ha/corosync.git
+ Vcs-Browser: https://anonscm.debian.org/cgit/debian-ha/corosync.git
+ 
++Package: corosync-pve
++Architecture: all
++Depends: corosync (= ${binary:Version})
++Description: Transitional package.
++
+ Package: corosync
+ Architecture: any
+ Pre-Depends: ${misc:Pre-Depends}
+@@ -39,6 +44,8 @@ Depends: ${shlibs:Depends},
+  lsb-base (>= 3.0-6),
+  adduser,
+  xsltproc
++Provides: corosync-pve (= ${binary:Version})
++Replaces: corosync-pve (<< 2.4.2-2)
+ Description: cluster engine daemon and utilities
+  ${DESCRIPTION}
+  This package contains the Corosync daemon and some administration tools.
+-- 
+2.1.4
+
diff --git a/patches/0002-don-t-install-default-corosync.conf.patch b/patches/0002-don-t-install-default-corosync.conf.patch
new file mode 100644
index 0000000..493148e
--- /dev/null
+++ b/patches/0002-don-t-install-default-corosync.conf.patch
@@ -0,0 +1,146 @@
+From 34924c90ccb5cb883ac135b35e3ffdd48c459db7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Tue, 7 Mar 2017 13:32:02 +0100
+Subject: [PATCH 2/5] don't install default corosync.conf
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ debian/corosync.conf    | 111 ------------------------------------------------
+ debian/corosync.install |   1 -
+ 2 files changed, 112 deletions(-)
+ delete mode 100644 debian/corosync.conf
+
+diff --git a/debian/corosync.conf b/debian/corosync.conf
+deleted file mode 100644
+index 0444432..0000000
+--- a/debian/corosync.conf
++++ /dev/null
+@@ -1,111 +0,0 @@
+-# Please read the corosync.conf.5 manual page
+-totem {
+-	version: 2
+-
+-	# Corosync itself works without a cluster name, but DLM needs one.
+-	# The cluster name is also written into the VG metadata of newly
+-	# created shared LVM volume groups, if lvmlockd uses DLM locking.
+-	# It is also used for computing mcastaddr, unless overridden below.
+-	cluster_name: debian
+-
+-	# How long before declaring a token lost (ms)
+-	token: 3000
+-
+-	# How many token retransmits before forming a new configuration
+-	token_retransmits_before_loss_const: 10
+-
+-	# Limit generated nodeids to 31-bits (positive signed integers)
+-	clear_node_high_bit: yes
+-
+-	# crypto_cipher and crypto_hash: Used for mutual node authentication.
+-	# If you choose to enable this, then do remember to create a shared
+-	# secret with "corosync-keygen".
+-	# enabling crypto_cipher, requires also enabling of crypto_hash.
+-	# crypto_cipher and crypto_hash should be used instead of deprecated
+-	# secauth parameter.
+-
+-	# Valid values for crypto_cipher are none (no encryption), aes256, aes192,
+-	# aes128 and  3des. Enabling crypto_cipher, requires also enabling of
+-	# crypto_hash.
+-	crypto_cipher: none
+-
+-	# Valid values for crypto_hash are  none  (no  authentication),  md5,  sha1,
+-	# sha256, sha384 and sha512.
+-	crypto_hash: none
+-
+-	# Optionally assign a fixed node id (integer)
+-	# nodeid: 1234
+-
+-	# interface: define at least one interface to communicate
+-	# over. If you define more than one interface stanza, you must
+-	# also set rrp_mode.
+-	interface {
+-		# Rings must be consecutively numbered, starting at 0.
+-		ringnumber: 0
+-		# This is normally the *network* address of the
+-		# interface to bind to. This ensures that you can use
+-		# identical instances of this configuration file
+-		# across all your cluster nodes, without having to
+-		# modify this option.
+-		bindnetaddr: 127.0.0.1
+-		# However, if you have multiple physical network
+-		# interfaces configured for the same subnet, then the
+-		# network address alone is not sufficient to identify
+-		# the interface Corosync should bind to. In that case,
+-		# configure the *host* address of the interface
+-		# instead:
+-		# bindnetaddr: 192.168.1.1
+-		# When selecting a multicast address, consider RFC
+-		# 2365 (which, among other things, specifies that
+-		# 239.255.x.x addresses are left to the discretion of
+-		# the network administrator). Do not reuse multicast
+-		# addresses across multiple Corosync clusters sharing
+-		# the same network.
+-		# mcastaddr: 239.255.1.1
+-		# Corosync uses the port you specify here for UDP
+-		# messaging, and also the immediately preceding
+-		# port. Thus if you set this to 5405, Corosync sends
+-		# messages over UDP ports 5405 and 5404.
+-		mcastport: 5405
+-		# Time-to-live for cluster communication packets. The
+-		# number of hops (routers) that this ring will allow
+-		# itself to pass. Note that multicast routing must be
+-		# specifically enabled on most network routers.
+-		ttl: 1
+-	}
+-}
+-
+-logging {
+-	# Log the source file and line where messages are being
+-	# generated. When in doubt, leave off. Potentially useful for
+-	# debugging.
+-	fileline: off
+-	# Log to standard error. When in doubt, set to no. Useful when
+-	# running in the foreground (when invoking "corosync -f")
+-	to_stderr: no
+-	# Log to a log file. When set to "no", the "logfile" option
+-	# must not be set.
+-	to_logfile: no
+-	#logfile: /var/log/corosync/corosync.log
+-	# Log to the system log daemon. When in doubt, set to yes.
+-	to_syslog: yes
+-	# Log with syslog facility daemon.
+-	syslog_facility: daemon
+-	# Log debug messages (very verbose). When in doubt, leave off.
+-	debug: off
+-	# Log messages with time stamps. When in doubt, set to on
+-	# (unless you are only logging to syslog, where double
+-	# timestamps can be annoying).
+-	timestamp: on
+-	logger_subsys {
+-		subsys: QUORUM
+-		debug: off
+-	}
+-}
+-
+-quorum {
+-	# Enable and configure quorum subsystem (default: off)
+-	# see also corosync.conf.5 and votequorum.5
+-	provider: corosync_votequorum
+-	expected_votes: 2
+-}
+diff --git a/debian/corosync.install b/debian/corosync.install
+index da4efa1..3c03c3f 100755
+--- a/debian/corosync.install
++++ b/debian/corosync.install
+@@ -31,6 +31,5 @@ usr/share/augeas/lenses/corosync.aug
+ usr/share/augeas/lenses/tests/test_corosync.aug
+ etc/corosync/corosync.*example* usr/share/doc/corosync/examples
+ etc/corosync/uidgid.d
+-debian/corosync.conf etc/corosync
+ usr/share/corosync/xml2conf.xsl
+ var/lib/corosync
+-- 
+2.1.4
+
diff --git a/patches/0003-restart-after-package-upgrade-is-complete.patch b/patches/0003-restart-after-package-upgrade-is-complete.patch
new file mode 100644
index 0000000..3c5eec2
--- /dev/null
+++ b/patches/0003-restart-after-package-upgrade-is-complete.patch
@@ -0,0 +1,30 @@
+From d962302d3a91eb614c6ecccf836b30032f1ae600 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Wed, 8 Mar 2017 12:12:05 +0100
+Subject: [PATCH 3/5] restart after package upgrade is complete
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ debian/rules | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/debian/rules b/debian/rules
+index d43bf29..f45847c 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -86,6 +86,9 @@ override_dh_systemd_enable:
+ 	dh_systemd_enable -p corosync-qdevice --no-enable
+ 	dh_systemd_enable --remaining-packages
+ 
++override_dh_systemd_start:
++	dh_systemd_start -r --restart-after-upgrade
++
+ override_dh_strip:
+ 	dh_strip --dbgsym-migration=corosync-dbg
+ 
+-- 
+2.1.4
+
diff --git a/patches/0004-remove-init-script.patch b/patches/0004-remove-init-script.patch
new file mode 100644
index 0000000..b0e3977
--- /dev/null
+++ b/patches/0004-remove-init-script.patch
@@ -0,0 +1,145 @@
+From 047ef59e56d1456283e2d4df68234e8b88f36a2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Wed, 8 Mar 2017 12:59:37 +0100
+Subject: [PATCH 4/5] remove init script
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ debian/corosync.init | 122 ---------------------------------------------------
+ 1 file changed, 122 deletions(-)
+ delete mode 100644 debian/corosync.init
+
+diff --git a/debian/corosync.init b/debian/corosync.init
+deleted file mode 100644
+index f7b813a..0000000
+--- a/debian/corosync.init
++++ /dev/null
+@@ -1,122 +0,0 @@
+-#! /bin/sh
+-#
+-### BEGIN INIT INFO
+-# Provides:          corosync
+-# Required-Start:    $network $remote_fs $syslog
+-# Required-Stop:     $network $remote_fs $syslog
+-# Default-Start:     2 3 4 5
+-# Default-Stop:      0 1 6
+-# Short-Description: corosync cluster framework
+-# Description:       Manages the Corosync Cluster Engine.
+-### END INIT INFO
+-
+-# Author: Fabio M. Di Nitto <fabbione at ubuntu.com>
+-
+-# PATH should only include /usr/* if it runs after the mountnfs.sh script
+-PATH=/usr/sbin:/usr/bin:/sbin:/bin
+-DESC="corosync daemon"
+-NAME=corosync
+-DAEMON=/usr/sbin/$NAME
+-OPTIONS=""
+-PIDFILE=/var/run/$NAME.pid
+-SCRIPTNAME=/etc/init.d/$NAME
+-PIDFILE=/var/run/corosync.pid
+-RARUNDIR=/var/run/resource-agents
+-
+-# Exit if the package is not installed
+-[ -x "$DAEMON" ] || exit 0
+-
+-# Read configuration variable file if it is present
+-set -a
+-[ -r /etc/default/corosync ] && . /etc/default/corosync
+-set +a
+-
+-# Make sure the Resource Agents run dir exists. Otherwise create it.
+-[ -d "$RARUNDIR" ] || mkdir -p $RARUNDIR
+-
+-# Define LSB log_* functions.
+-# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+-. /lib/lsb/init-functions
+-
+-#
+-# Function that starts the daemon/service
+-#
+-do_start()
+-{
+-	# Return
+-	#   0 if daemon has been started
+-	#   1 if daemon was already running
+-	#   2 if daemon could not be started
+-	start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \
+-		|| return 1
+-	start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS \
+-		|| return 2
+-	# Add code here, if necessary, that waits for the process to be ready
+-	# to handle requests from services started subsequently which depend
+-	# on this one.  As a last resort, sleep for some time.
+-	pidof corosync > $PIDFILE
+-}
+-
+-#
+-# Function that stops the daemon/service
+-#
+-do_stop()
+-{
+-	# Return
+-	#   0 if daemon has been stopped
+-	#   1 if daemon was already stopped
+-	#   2 if daemon could not be stopped
+-	#   other if a failure occurred
+-	start-stop-daemon --stop --quiet --retry forever/QUIT/1 --pidfile $PIDFILE
+-	RETVAL="$?"
+-	[ "$RETVAL" = 2 ] && return 2
+-	# Many daemons don't delete their pidfiles when they exit.
+-	rm -f $PIDFILE
+-	return "$RETVAL"
+-}
+-
+-case "$1" in
+-  start)
+-	log_daemon_msg "Starting $DESC" "$NAME"
+-	do_start
+-	case "$?" in
+-		0|1) log_end_msg 0 ;;
+-		2) log_end_msg 1 ;;
+-	esac
+-	;;
+-  stop)
+-	log_daemon_msg "Stopping $DESC" "$NAME"
+-	do_stop
+-	case "$?" in
+-		0|1) log_end_msg 0 ;;
+-		2) log_end_msg 1 ;;
+-	esac
+-	;;
+-  restart|force-reload)
+-	log_daemon_msg "Restarting $DESC" "$NAME"
+-	do_stop
+-	case "$?" in
+-	  0|1)
+-		do_start
+-		case "$?" in
+-			0) log_end_msg 0 ;;
+-			1) log_end_msg 1 ;; # Old process is still running
+-			*) log_end_msg 1 ;; # Failed to start
+-		esac
+-		;;
+-	  *)
+-	  	# Failed to stop
+-		log_end_msg 1
+-		;;
+-	esac
+-	;;
+-  status|monitor)
+-	status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
+-	;;
+-  *)
+-	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+-	exit 3
+-	;;
+-esac
+-
+-:
+-- 
+2.1.4
+
diff --git a/patches/0005-add-corosync-pve-postinst-for-restart-on-dist-upgrad.patch b/patches/0005-add-corosync-pve-postinst-for-restart-on-dist-upgrad.patch
new file mode 100644
index 0000000..6bc6c46
--- /dev/null
+++ b/patches/0005-add-corosync-pve-postinst-for-restart-on-dist-upgrad.patch
@@ -0,0 +1,35 @@
+From 864034f37d1430cdca37bdc8f5a336b5dd8db0f2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler at proxmox.com>
+Date: Wed, 8 Mar 2017 14:08:04 +0100
+Subject: [PATCH 5/5] add corosync-pve postinst for restart on dist-upgrade
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
+---
+ debian/corosync-pve.postinst | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+ create mode 100755 debian/corosync-pve.postinst
+
+diff --git a/debian/corosync-pve.postinst b/debian/corosync-pve.postinst
+new file mode 100755
+index 0000000..dddd239
+--- /dev/null
++++ b/debian/corosync-pve.postinst
+@@ -0,0 +1,12 @@
++#!/bin/sh
++
++set -e
++
++if [ "$1" = "configure" ]; then
++	if [ -n "$2" ]; then
++		# switching package name from corosync-pve to corosync requires a manual restart on upgrade, once
++		if dpkg --compare-versions "$2" lt "2.4.2-pve1" ; then
++			deb-systemd-invoke start corosync.service > /dev/null || true
++		fi
++	fi
++fi
+-- 
+2.1.4
+
diff --git a/patches/series b/patches/series
new file mode 100644
index 0000000..efd72f0
--- /dev/null
+++ b/patches/series
@@ -0,0 +1,5 @@
+0001-add-Provides-Replaces-corosync-pve.patch
+0002-don-t-install-default-corosync.conf.patch
+0003-restart-after-package-upgrade-is-complete.patch
+0004-remove-init-script.patch
+0005-add-corosync-pve-postinst-for-restart-on-dist-upgrad.patch
-- 
2.1.4





More information about the pve-devel mailing list