Merge ~sergiodj/ubuntu/+source/drbd-utils:fix-timeout-jammy into ubuntu/+source/drbd-utils:ubuntu/jammy-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 1f478da3901e355b6a283636af071f2e175de3cd
Proposed branch: ~sergiodj/ubuntu/+source/drbd-utils:fix-timeout-jammy
Merge into: ubuntu/+source/drbd-utils:ubuntu/jammy-devel
Diff against target: 279 lines (+239/-1)
5 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/lp2043817-fix-timeout-pacemaker-jammy-01.patch (+138/-0)
debian/patches/lp2043817-fix-timeout-pacemaker-jammy-02.patch (+90/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Andreas Hasenack Approve
Canonical Server Reporter Pending
Review via email: mp+457270@code.launchpad.net

Description of the change

This MP fixes bug #2043817.

The problem and the solution are described in the SRU text.

PPA: https://launchpad.net/~sergiodj/+archive/ubuntu/drbd-utils

dep8 results (superficial) to be posted later.

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

+1, just a nit in the version number for the SRU.

Agreed only jammy is affected, and the second patch on top is much better, as parsing --help is really brittle.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: sergiodj, ahasenack
Uploaders: sergiodj, ahasenack
MP auto-approved

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Andreas.

Uploaded:

$ dput drbd-utils_9.15.0-1ubuntu0.1_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/drbd-utils/drbd-utils_9.15.0-1ubuntu0.1_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/drbd-utils/drbd-utils_9.15.0-1ubuntu0.1.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading drbd-utils_9.15.0-1ubuntu0.1.dsc: done.
  Uploading drbd-utils_9.15.0-1ubuntu0.1.debian.tar.xz: done.
  Uploading drbd-utils_9.15.0-1ubuntu0.1_source.buildinfo: done.
  Uploading drbd-utils_9.15.0-1ubuntu0.1_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 53517a4..24ec5f6 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+drbd-utils (9.15.0-1ubuntu0.1) jammy; urgency=medium
7+
8+ * d/p/lp2043817-fix-timeout-pacemaker-jammy-*.patch: Fix timeout
9+ issue with Pacemaker. (LP: #2043817)
10+
11+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Tue, 21 Nov 2023 14:16:59 -0500
12+
13 drbd-utils (9.15.0-1build2) jammy; urgency=medium
14
15 * No-change rebuild for ppc64el baseline bump.
16diff --git a/debian/control b/debian/control
17index f0ee3e6..2cd9978 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,7 +1,8 @@
21 Source: drbd-utils
22 Section: admin
23 Priority: optional
24-Maintainer: Debian DRBD Maintainers <debian-ha-maintainers@lists.alioth.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Debian DRBD Maintainers <debian-ha-maintainers@lists.alioth.debian.org>
27 Uploaders: Norbert Tretkowski <norbert@tretkowski.de>,
28 Martin Loschwitz <madkiss@debian.org>,
29 Philipp Hug <debian@hug.cx>,
30diff --git a/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-01.patch b/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-01.patch
31new file mode 100644
32index 0000000..6436be4
33--- /dev/null
34+++ b/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-01.patch
35@@ -0,0 +1,138 @@
36+From: Lars Ellenberg <lars.ellenberg@linbit.com>
37+Date: Wed, 12 Jan 2022 13:50:35 +0100
38+Subject: crm-fence-peer: fix timeout with Pacemaker 2.1: milli seconds vs
39+ seconds
40+MIME-Version: 1.0
41+Content-Type: text/plain; charset="utf-8"
42+Content-Transfer-Encoding: 8bit
43+
44+crmadmin timeout was in milli seconds for <= 2.0.x,
45+but became a TIMESPEC with default seconds in >= 2.1.
46+
47+Up to 2.0.4, atoi() was used, which effectively ignores "trailing garbage",
48+so we could get away with always appending "ms".
49+But with 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
50+"Cannot parse integer value “200ms” for --timeout" :-|
51+
52+So grep the help message for "timeout.*milliseconds",
53+and if not present, append an explicit "ms" unit.
54+
55+Also tolerate both ": ok" (2.1) and " (ok)" (older)
56+when matching the output string of crmadmin -S.
57+
58+
59+Origin: upstream, https://github.com/LINBIT/drbd-utils/commit/8a28be74bc6efa93931c957e54c01abb18b984fe
60+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/drbd-utils/+bug/2043817
61+---
62+ scripts/crm-fence-peer.9.sh | 24 +++++++++++++++++++++---
63+ scripts/crm-fence-peer.sh | 24 +++++++++++++++++++++---
64+ 2 files changed, 42 insertions(+), 6 deletions(-)
65+
66+diff --git a/scripts/crm-fence-peer.9.sh b/scripts/crm-fence-peer.9.sh
67+index 36590bd..c943bf9 100755
68+--- a/scripts/crm-fence-peer.9.sh
69++++ b/scripts/crm-fence-peer.9.sh
70+@@ -392,6 +392,20 @@ check_cluster_properties()
71+ crm_is_not_false ${stonith_enabled:-} && stonith_enabled=true || stonith_enabled=false
72+ }
73+
74++setup_crm_timeout_unit_ms()
75++{
76++ # crmadmin timeout was in ms for <= 2.0.x,
77++ # but became a TIMESPEC in >= 2.1.
78++ # Up to 2.0.4, atoi() was used, which effectively ignores "trailing
79++ # garbage", so we could get away with always appending "ms", but with
80++ # 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
81++ # "Cannot parse integer value “200ms” for --timeout" :-|
82++ if crmadmin --help 2>&1 | grep -q -e "--timeout=.*in milliseconds"; then
83++ crm_timeout_unit_ms=""
84++ else
85++ crm_timeout_unit_ms="ms"
86++ fi
87++}
88+
89+ #
90+ # In case this is a two-node cluster (still common with
91+@@ -737,6 +751,7 @@ drbd_peer_fencing()
92+
93+ local startup_fencing stonith_enabled
94+ check_cluster_properties
95++ setup_crm_timeout_unit_ms
96+
97+ if ! $had_constraint_on_entry ; then
98+
99+@@ -1075,14 +1090,17 @@ _check_peer_node_reachable()
100+ # it is obviously reachable.
101+ #
102+ # Do this only after we have been able to reach a DC above.
103+- # Note: crmadmin timeout is in milli-seconds, and defaults to 30000 (30 seconds).
104++ # Note: crmadmin timeout defaults to 30 seconds.
105++ #
106+ # Our variable $cibtimeout should be in deci-seconds (see above)
107+ # (unless you use a very old version of pacemaker, so don't do that).
108+ # Convert deci-seconds to milli-seconds, and double it.
109++ # See also setup_crm_timeout_unit_ms() above.
110++ #
111+ if [[ $crmd = "online" ]] ; then
112+ local out
113+- if out=$( crmadmin -t $(( cibtimeout * 200 )) -S $DRBD_PEER ) \
114+- && [[ $out = *"(ok)" ]]; then
115++ if out=$( crmadmin -t $(( cibtimeout * 200 ))$crm_timeout_unit_ms -S $DRBD_PEER ) \
116++ && [[ $out = *@(": ok"|" (ok)") ]]; then
117+ peer_state="reachable"
118+ return
119+ fi
120+diff --git a/scripts/crm-fence-peer.sh b/scripts/crm-fence-peer.sh
121+index cb5dede..9678673 100755
122+--- a/scripts/crm-fence-peer.sh
123++++ b/scripts/crm-fence-peer.sh
124+@@ -244,6 +244,20 @@ check_cluster_properties()
125+ crm_is_not_false $stonith_enabled && stonith_enabled=true || stonith_enabled=false
126+ }
127+
128++setup_crm_timeout_unit_ms()
129++{
130++ # crmadmin timeout was in ms for <= 2.0.x,
131++ # but became a TIMESPEC in >= 2.1.
132++ # Up to 2.0.4, atoi() was used, which effectively ignores "trailing
133++ # garbage", so we could get away with always appending "ms", but with
134++ # 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
135++ # "Cannot parse integer value “200ms” for --timeout" :-|
136++ if crmadmin --help 2>&1 | grep -q -e "--timeout=.*in milliseconds"; then
137++ crm_timeout_unit_ms=""
138++ else
139++ crm_timeout_unit_ms="ms"
140++ fi
141++}
142+
143+ #
144+ # In case this is a two-node cluster (still common with
145+@@ -426,6 +440,7 @@ drbd_peer_fencing()
146+
147+ local startup_fencing stonith_enabled
148+ check_cluster_properties
149++ setup_crm_timeout_unit_ms
150+
151+ if [[ -z $have_constraint ]] ; then
152+ # try to place it.
153+@@ -718,14 +733,17 @@ check_peer_node_reachable()
154+ # it is obviously reachable.
155+ #
156+ # Do this only after we have been able to reach a DC above.
157+- # Note: crmadmin timeout is in milli-seconds, and defaults to 30000 (30 seconds).
158++ # Note: crmadmin timeout defaults to 30 seconds.
159++ #
160+ # Our variable $cibtimeout should be in deci-seconds (see above)
161+ # (unless you use a very old version of pacemaker, so don't do that).
162+ # Convert deci-seconds to milli-seconds, and double it.
163++ # See also setup_crm_timeout_unit_ms() above.
164++ #
165+ if [[ $crmd = "online" ]] ; then
166+ local out
167+- if out=$( crmadmin -t $(( cibtimeout * 200 )) -S $DRBD_PEER ) \
168+- && [[ $out = *"(ok)" ]]; then
169++ if out=$( crmadmin -t $(( cibtimeout * 200 ))$crm_timeout_unit_ms -S $DRBD_PEER ) \
170++ && [[ $out = *@(": ok"|" (ok)") ]]; then
171+ peer_state="reachable"
172+ return
173+ fi
174diff --git a/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-02.patch b/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-02.patch
175new file mode 100644
176index 0000000..f7a5038
177--- /dev/null
178+++ b/debian/patches/lp2043817-fix-timeout-pacemaker-jammy-02.patch
179@@ -0,0 +1,90 @@
180+From: Lars Ellenberg <lars.ellenberg@linbit.com>
181+Date: Wed, 12 Jan 2022 13:50:35 +0100
182+Subject: crm-fence-peer: fix timeout with Pacemaker 2.0.5: milli seconds vs
183+ seconds
184+MIME-Version: 1.0
185+Content-Type: text/plain; charset="utf-8"
186+Content-Transfer-Encoding: 8bit
187+
188+Addendum to 8a28be74bc6efa93931c957e54c01abb18b984fe
189+Commit message of the above cited here:
190+
191+> crmadmin timeout was in milli seconds for <= 2.0.x,
192+> but became a TIMESPEC with default seconds in >= 2.1.
193+>
194+> Up to 2.0.4, atoi() was used, which effectively ignores "trailing garbage",
195+> so we could get away with always appending "ms".
196+> But with 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
197+> "Cannot parse integer value “200ms” for --timeout" :-|
198+>
199+> So grep the help message for "timeout.*milliseconds",
200+> and if not present, append an explicit "ms" unit.
201+
202+And this is where I got it wrong :-(
203+somewhere later they re-organised the help text
204+so now I would need to parse --help-all.
205+
206+Instead try to actually call "crmadmin -t 100ms --version".
207+If that works, it apparently understands (or ignores)
208+the "ms" unit.
209+
210+
211+Origin: upstream, https://github.com/LINBIT/drbd-utils/commit/3eec04bc65b39b04be21d2689568892e7788abb3
212+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/drbd-utils/+bug/2043817
213+---
214+ scripts/crm-fence-peer.9.sh | 14 +++++++++++---
215+ scripts/crm-fence-peer.sh | 14 +++++++++++---
216+ 2 files changed, 22 insertions(+), 6 deletions(-)
217+
218+diff --git a/scripts/crm-fence-peer.9.sh b/scripts/crm-fence-peer.9.sh
219+index c943bf9..fc8d2bc 100755
220+--- a/scripts/crm-fence-peer.9.sh
221++++ b/scripts/crm-fence-peer.9.sh
222+@@ -400,10 +400,18 @@ setup_crm_timeout_unit_ms()
223+ # garbage", so we could get away with always appending "ms", but with
224+ # 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
225+ # "Cannot parse integer value “200ms” for --timeout" :-|
226+- if crmadmin --help 2>&1 | grep -q -e "--timeout=.*in milliseconds"; then
227+- crm_timeout_unit_ms=""
228+- else
229++ # Can not parse the help text reliably, because they changed content
230++ # and organisation of the help text between 2.0.4 and 2.0.5.
231++ # Just try using ms unit, and see if it fails.
232++ if crmadmin -t 100ms --version &> /dev/null; then
233++ # this is either a recent version that actually understands ms
234++ # as part of the TIMESPEC, or a version that still uses atoi().
235+ crm_timeout_unit_ms="ms"
236++ else
237++ # this one likely failed with
238++ # crmadmin: Cannot parse integer value “100ms” for -t
239++ # (>= 2.0.5, < 2.1)
240++ crm_timeout_unit_ms=""
241+ fi
242+ }
243+
244+diff --git a/scripts/crm-fence-peer.sh b/scripts/crm-fence-peer.sh
245+index 9678673..b0e4e0f 100755
246+--- a/scripts/crm-fence-peer.sh
247++++ b/scripts/crm-fence-peer.sh
248+@@ -252,10 +252,18 @@ setup_crm_timeout_unit_ms()
249+ # garbage", so we could get away with always appending "ms", but with
250+ # 2.0.5, it became g_option_context_parse G_OPTION_ARG_INT, which
251+ # "Cannot parse integer value “200ms” for --timeout" :-|
252+- if crmadmin --help 2>&1 | grep -q -e "--timeout=.*in milliseconds"; then
253+- crm_timeout_unit_ms=""
254+- else
255++ # Can not parse the help text reliably, because they changed content
256++ # and organisation of the help text between 2.0.4 and 2.0.5.
257++ # Just try using ms unit, and see if it fails.
258++ if crmadmin -t 100ms --version &> /dev/null; then
259++ # this is either a recent version that actually understands ms
260++ # as part of the TIMESPEC, or a version that still uses atoi().
261+ crm_timeout_unit_ms="ms"
262++ else
263++ # this one likely failed with
264++ # crmadmin: Cannot parse integer value “100ms” for -t
265++ # (>= 2.0.5, < 2.1)
266++ crm_timeout_unit_ms=""
267+ fi
268+ }
269+
270diff --git a/debian/patches/series b/debian/patches/series
271index d247244..65f9334 100644
272--- a/debian/patches/series
273+++ b/debian/patches/series
274@@ -6,3 +6,5 @@
275 0006-initscript-add-start-runlevels.patch
276 0007-drbdmon-buildflags.patch
277 0008-drbdmon-pass-LDFLAGS-to-g.patch
278+lp2043817-fix-timeout-pacemaker-jammy-01.patch
279+lp2043817-fix-timeout-pacemaker-jammy-02.patch

Subscribers

People subscribed via source and target branches