Hello community,

here is the log from the commit of package drbd-utils for openSUSE:Factory 
checked in at 2020-03-11 18:51:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/drbd-utils (Old)
 and      /work/SRC/openSUSE:Factory/.drbd-utils.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "drbd-utils"

Wed Mar 11 18:51:52 2020 rev:36 rq:783590 version:9.12.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/drbd-utils/drbd-utils.changes    2020-02-25 
16:07:52.580657282 +0100
+++ /work/SRC/openSUSE:Factory/.drbd-utils.new.3160/drbd-utils.changes  
2020-03-11 18:54:51.511661794 +0100
@@ -1,0 +2,6 @@
+Tue Mar 10 09:10:40 UTC 2020 - nick wang <[email protected]>
+
+- bsc#1166200 ,fix crm-fence-peer regex issue with pacemaker 2.
+- Add patch crm-fence-peer-pacemaker2.patch
+
+-------------------------------------------------------------------

New:
----
  crm-fence-peer-pacemaker2.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ drbd-utils.spec ++++++
--- /var/tmp/diff_new_pack.E13Eke/_old  2020-03-11 18:54:52.451662214 +0100
+++ /var/tmp/diff_new_pack.E13Eke/_new  2020-03-11 18:54:52.455662216 +0100
@@ -36,6 +36,7 @@
 # PATCH-SUSE-FIX: Disable quorum in default configuration (bsc#1032142)
 Patch4:         0001-Disable-quorum-in-default-configuration-bsc-1032142.patch
 Patch5:         move_fencing_from_disk_to_net_in_example.patch
+Patch6:         crm-fence-peer-pacemaker2.patch
 
 Provides:       drbd-bash-completion = %{version}
 Provides:       drbd-pacemaker = %{version}
@@ -86,6 +87,7 @@
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %build
 export WANT_DRBD_REPRODUCIBLE_BUILD=1

++++++ crm-fence-peer-pacemaker2.patch ++++++
commit fd2eec6eca91e3d4d24852b5bac4dd61f9854e67
Author: Lars Ellenberg <[email protected]>
Date:   Mon Mar 2 14:12:55 2020 +0100

    crm-fence-peer: detect pacemaker 2 "promotable clones"
    
    The sed-script to guess the pacemaker xml-id to be used in location
    constraints from the DRBD resource name expected '<master' tags, but
    with new pacemaker 2 xml, these are '<clone's, with "promotable=true"
    set in the meta attributes.
    
    Use the crm_feature_set version from the top level <cib/> tag
    to decide between the two.

diff --git a/scripts/crm-fence-peer.9.sh b/scripts/crm-fence-peer.9.sh
index 94c32747..26b67b9e 100755
--- a/scripts/crm-fence-peer.9.sh
+++ b/scripts/crm-fence-peer.9.sh
@@ -197,15 +197,28 @@ fence_peer_init()
 {
        # we know which instance we are: $OCF_RESOURCE_INSTANCE.
        # but we do not know the xml ID of the <master/> :(
+
+       # with Pacemaker 2, its "promotable clones" instead of the
+       # "master" (which was deemed a bad naming choice).
+       # detect older pacemaker by crm_feature_set < 3.1.0
+       local clone_or_master=clone
+       case $crm_feature_set in
+               3.0.*|[012].*)  : "pacemaker version < 2, master slave"
+                       clone_or_master=master ;;
+       esac
+
        # cibadmin -Ql --xpath \
        # '//master[primitive[@type="drbd" and instance_attributes/nvpair[@name 
= "drbd_resource" and @value="r0"]]]/@id'
        # but I'd have to pipe that through sed anyways, because @attribute
        # xpath queries are not supported.
        # and I'd be incompatible with older cibadmin not supporting --xpath.
-       # be cool, sed it out:
+       # be cool, sed it out.
+       # I could be more strict about primitive class:provider:type,
+       # or double check that it is in fact a promotable="true" clone...
+       # But in the real world, this is good enough.
        : ${master_id=$(set +x; echo "$cib_xml" |
-               sed -ne '/<master /,/<\/master>/ {
-                          /<master / h;
+               sed -ne "/<$clone_or_master /,/<\\/$clone_or_master>/ {
+                          /<$clone_or_master / h;"'
                             /<primitive/,/<\/primitive/ {
                               /<instance_attributes/,/<\/instance_attributes/ {
                                 /<nvpair .*\bname="drbd_resource"/ {
diff --git a/scripts/crm-fence-peer.sh b/scripts/crm-fence-peer.sh
index 513773fe..b7b62cfd 100755
--- a/scripts/crm-fence-peer.sh
+++ b/scripts/crm-fence-peer.sh
@@ -51,15 +51,28 @@ fence_peer_init()
 {
        # we know which instance we are: $OCF_RESOURCE_INSTANCE.
        # but we do not know the xml ID of the <master/> :(
+
+       # with Pacemaker 2, its "promotable clones" instead of the
+       # "master" (which was deemed a bad naming choice).
+       # detect older pacemaker by crm_feature_set < 3.1.0
+       local clone_or_master=clone
+       case $crm_feature_set in
+               3.0.*|[012].*)  : "pacemaker version < 2, master slave"
+                       clone_or_master=master ;;
+       esac
+
        # cibadmin -Ql --xpath \
        # '//master[primitive[@type="drbd" and instance_attributes/nvpair[@name 
= "drbd_resource" and @value="r0"]]]/@id'
        # but I'd have to pipe that through sed anyways, because @attribute
        # xpath queries are not supported.
        # and I'd be incompatible with older cibadmin not supporting --xpath.
-       # be cool, sed it out:
+       # be cool, sed it out.
+       # I could be more strict about primitive class:provider:type,
+       # or double check that it is in fact a promotable="true" clone...
+       # But in the real world, this is good enough.
        : ${master_id=$(set +x; echo "$cib_xml" |
-               sed -ne '/<master /,/<\/master>/ {
-                          /<master / h;
+               sed -ne "/<$clone_or_master /,/<\\/$clone_or_master>/ {
+                          /<$clone_or_master / h;"'
                             /<primitive/,/<\/primitive/ {
                               /<instance_attributes/,/<\/instance_attributes/ {
                                 /<nvpair .*\bname="drbd_resource"/ {

Reply via email to