Relocate drbd-tools to stx-integ/filesystem/drbd/drbd-tools

Move content from stx-gplv2 into stx-integ

Packages will be relocated to

stx-integ:
    base/
        bash
        cgcs-users
        cluster-resource-agents
        dpkg
        haproxy
        libfdt
        netpbm
        rpm

    database/
        mariadb

    filesystem/
        iscsi-initiator-utils

    filesystem/drbd/
        drbd-tools

    kernel/kernel-modules/
        drbd
        integrity
        intel-e1000e
        intel-i40e
        intel-i40evf
        intel-ixgbe
        intel-ixgbevf
        qat17
        tpmdd

    ldap/
        ldapscripts

    networking/
        iptables
        net-tools

Change-Id: Ibf3a0fc29dc2e6a0eeb02c98ff053bdb0443a9f0
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2018-08-01 14:23:50 -04:00
parent 59457eb9f6
commit 18f91ec6be
12 changed files with 1146 additions and 0 deletions

View File

@ -136,3 +136,4 @@ base/netpbm
filesystem/iscsi-initiator-utils
ldap/ldapscripts
networking/net-tools
filesystem/drbd/drbd-tools

View File

@ -0,0 +1,4 @@
COPY_LIST="$FILES_BASE/* \
$DISTRO/patches/* \
$CGCS_BASE/downloads/drbd-8.4.3.tar.gz"
TIS_PATCH_VER=6

View File

@ -0,0 +1,407 @@
# Define init script directory. %{_initddir} is available from Fedora
# 9 forward; CentOS knows 5 only %{_initrddir}. Neither are known to
# autoconf...
%{!?_initddir: %{expand: %%global _initddir %{_initrddir}}}
# Compatibility macro wrappers for legacy RPM versions that do not
# support conditional builds
%{!?bcond_without: %{expand: %%global bcond_without() %%{expand:%%%%{!?_without_%%{1}:%%%%global with_%%{1} 1}}}}
%{!?bcond_with: %{expand: %%global bcond_with() %%{expand:%%%%{?_with_%%{1}:%%%%global with_%%{1} 1}}}}
%{!?with: %{expand: %%global with() %%{expand:%%%%{?with_%%{1}:1}%%%%{!?with_%%{1}:0}}}}
%{!?without: %{expand: %%global without() %%{expand:%%%%{?with_%%{1}:0}%%%%{!?with_%%{1}:1}}}}
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features
%bcond_without udev
%bcond_without pacemaker
%bcond_with rgmanager
%bcond_without heartbeat
# conditionals may not contain "-" nor "_", hence "bashcompletion"
%bcond_without bashcompletion
# --with xen is ignored on any non-x86 architecture
%bcond_without xen
%bcond_without legacy_utils
#%ifnarch %{ix86} x86_64
%global _without_xen --without-xen
#%endif
Name: drbd
Summary: DRBD driver for Linux
Version: 8.4.3
Release: 0%{?_tis_dist}.%{tis_patch_ver}
Source: http://oss.linbit.com/%{name}/8.3/%{name}-%{version}.tar.gz
Source1: drbd.service
# WRS
Patch0001: 0001-skip_wait_con_int_on_simplex.patch
Patch0002: 0002-drbd-conditional-crm-dependency.patch
Patch0003: 0003-drbd_report_condition.patch
Patch0004: 0004-drbdadm-ipaddr-change.patch
Patch0005: 0005-drbd_reconnect_standby_standalone.patch
Patch0006: 0006-avoid-kernel-userspace-version-check.patch
Patch0007: 0007-Update-OCF-to-attempt-connect-in-certain-states.patch
Patch0008: 0008-Increase-short-cmd-timeout-to-15-secs.patch
License: GPLv2+
ExclusiveOS: linux
Group: System Environment/Kernel
URL: http://www.drbd.org/
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: flex
Requires: %{name}-utils = %{version}
%if %{with udev}
Requires: %{name}-udev = %{version}
BuildRequires: udev
%endif
%if %{with pacemaker}
Requires: %{name}-pacemaker = %{version}
%endif
## %if %{with rgmanager}
## ## No.
## ## We don't want to annoy the majority of our userbase on pacemaker
## ## by pulling in the full rgmanager stack via drbd-rgmanager as well.
## Requires: %{name}-rgmanager = %{version}
## %endif
%if %{with heartbeat}
Requires: %{name}-heartbeat = %{version}
%endif
%if %{with bashcompletion}
Requires: %{name}-bash-completion = %{version}
%endif
BuildRequires: systemd-devel
%description
DRBD mirrors a block device over the network to another machine.
Think of it as networked raid 1. It is a building block for
setting up high availability (HA) clusters.
This is a virtual package, installing the full DRBD userland suite.
# Just a few docs go into the "drbd" package. Everything else is part
# of one of the drbd-* packages.
%files
%defattr(-,root,root,-)
%doc COPYING
%doc ChangeLog
%doc README
%package utils
Summary: Management utilities for DRBD
Group: System Environment/Kernel
# We used to have one monolithic userland package.
# Since all other packages require drbd-utils,
# it should be sufficient to add the conflict here.
Conflicts: drbd < 8.3.6
# These exist in centos extras:
Conflicts: drbd82 drbd83
Requires(post): chkconfig
Requires(preun): chkconfig
%description utils
DRBD mirrors a block device over the network to another machine.
Think of it as networked raid 1. It is a building block for
setting up high availability (HA) clusters.
This packages includes the DRBD administration tools.
%files utils
%defattr(755,root,root,-)
/sbin/drbdsetup
/sbin/drbdadm
/sbin/drbdmeta
%if %{with legacy_utils}
%dir /lib/drbd/
/lib/drbd/drbdsetup-83
/lib/drbd/drbdadm-83
%endif
%{_initddir}/%{name}
%attr(644,root,root) %{_unitdir}/%{name}.service
%{_sbindir}/drbd-overview
%dir %{_prefix}/lib/%{name}
%{_prefix}/lib/%{name}/outdate-peer.sh
%{_prefix}/lib/%{name}/snapshot-resync-target-lvm.sh
%{_prefix}/lib/%{name}/unsnapshot-resync-target-lvm.sh
%{_prefix}/lib/%{name}/notify-out-of-sync.sh
%{_prefix}/lib/%{name}/notify-split-brain.sh
%{_prefix}/lib/%{name}/notify-emergency-reboot.sh
%{_prefix}/lib/%{name}/notify-emergency-shutdown.sh
%{_prefix}/lib/%{name}/notify-io-error.sh
%{_prefix}/lib/%{name}/notify-pri-lost-after-sb.sh
%{_prefix}/lib/%{name}/notify-pri-lost.sh
%{_prefix}/lib/%{name}/notify-pri-on-incon-degr.sh
%{_prefix}/lib/%{name}/notify.sh
%defattr(-,root,root,-)
%dir %{_var}/lib/%{name}
%config(noreplace) %attr(640, root, root) %{_sysconfdir}/drbd.conf
%dir %attr(740, root, root) %{_sysconfdir}/drbd.d
%config(noreplace) %{_sysconfdir}/drbd.d/global_common.conf
%{_mandir}/man8/drbd.8.*
%{_mandir}/man8/drbdsetup.8.*
%{_mandir}/man8/drbdadm.8.*
%{_mandir}/man5/drbd.conf.5.*
%{_mandir}/man8/drbdmeta.8.*
%doc scripts/drbd.conf.example
%doc COPYING
%doc ChangeLog
%doc README
%if %{with udev}
%package udev
Summary: udev integration scripts for DRBD
Group: System Environment/Kernel
Requires: %{name}-utils = %{version}-%{release}, udev
%description udev
This package contains udev helper scripts for DRBD, managing symlinks to
DRBD devices in /dev/drbd/by-res and /dev/drbd/by-disk.
%files udev
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/udev/rules.d/65-drbd.rules*
%endif # with udev
%if %{with pacemaker}
%package pacemaker
Summary: Pacemaker resource agent for DRBD
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
License: GPLv2
%description pacemaker
This package contains the master/slave DRBD resource agent for the
Pacemaker High Availability cluster manager.
%files pacemaker
%defattr(755,root,root,-)
%{_prefix}/lib/%{name}/crm-fence-peer.sh
%{_prefix}/lib/%{name}/crm-unfence-peer.sh
%{_prefix}/lib/%{name}/stonith_admin-fence-peer.sh
%{_prefix}/lib/ocf/resource.d/linbit/drbd
%endif # with pacemaker
# Dependencies for drbd-rgmanager are particularly awful. On RHEL 5
# and prior (and corresponding Fedora releases), %{_datadir}/cluster
# was owned by rgmanager version 2, so we have to depend on that.
#
# With Red Hat Cluster 3.0.1 (around Fedora 12), the DRBD resource
# agent was merged in, and it became part of the resource-agents 3
# package (which of course is different from resource-agents on all
# other platforms -- go figure). So for resource-agents >= 3, we must
# generally conflict.
#
# Then for RHEL 6, Red Hat in all their glory decided to keep the
# packaging scheme, but kicked DRBD out of the resource-agents
# package. Thus, for RHEL 6 specifically, we must not conflict with
# resource-agents >=3, but instead require it.
#
# The saga continues:
# In RHEL 6.1 they have listed the drbd resource agent as valid agent,
# but do not include it in their resource-agents package. -> So we
# drop any dependency regarding rgmanager's version.
#
# All of this for exactly two (2) files.
%if %{with rgmanager}
%package rgmanager
Summary: Red Hat Cluster Suite agent for DRBD
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
%description rgmanager
This package contains the DRBD resource agent for the Red Hat Cluster Suite
resource manager.
As of Red Hat Cluster Suite 3.0.1, the DRBD resource agent is included
in the Cluster distribution.
%files rgmanager
%defattr(755,root,root,-)
%{_datadir}/cluster/drbd.sh
%{_prefix}/lib/%{name}/rhcs_fence
%defattr(-,root,root,-)
%{_datadir}/cluster/drbd.metadata
%endif # with rgmanager
%if %{with heartbeat}
%package heartbeat
Summary: Heartbeat resource agent for DRBD
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
License: GPLv2
%description heartbeat
This package contains the DRBD resource agents for the Heartbeat cluster
resource manager (in v1 compatibility mode).
%files heartbeat
%defattr(755,root,root,-)
%{_sysconfdir}/ha.d/resource.d/drbddisk
%{_sysconfdir}/ha.d/resource.d/drbdupper
%defattr(-,root,root,-)
%{_mandir}/man8/drbddisk.8.*
%endif # with heartbeat
%if %{with bashcompletion}
%package bash-completion
Summary: Programmable bash completion support for drbdadm
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
%description bash-completion
This package contains programmable bash completion support for the drbdadm
management utility.
%files bash-completion
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/bash_completion.d/drbdadm*
%endif # with bashcompletion
%prep
%setup -q
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%build
%configure \
--with-utils \
--without-km \
%{?_without_udev} \
%{?_without_xen} \
%{?_without_pacemaker} \
%{?_without_heartbeat} \
%{?_with_rgmanager} \
%{?_without_bashcompletion} \
%{?_without_legacy_utils} \
--with-initdir=%{_initddir}
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 -p -D %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
%clean
rm -rf %{buildroot}
%post utils
chkconfig --add drbd
%if %{without udev}
for i in `seq 0 15` ; do
test -b /dev/drbd$i || mknod -m 0660 /dev/drbd$i b 147 $i;
done
%endif #without udev
%preun utils
if [ $1 -eq 0 ]; then
%{_initrddir}/drbd stop >/dev/null 2>&1
/sbin/chkconfig --del drbd
fi
%changelog
* Tue Feb 5 2013 Philipp Reisner <phil@linbit.com> - 8.4.3-1
- New upstream release.
* Thu Sep 6 2012 Philipp Reisner <phil@linbit.com> - 8.4.2-1
- New upstream release.
* Tue Feb 21 2012 Lars Ellenberg <lars@linbit.com> - 8.4.1-2
- Build fix for RHEL 6 and ubuntu lucid
* Tue Dec 20 2011 Philipp Reisner <phil@linbit.com> - 8.4.1-1
- New upstream release.
* Wed Jul 15 2011 Philipp Reisner <phil@linbit.com> - 8.4.0-1
- New upstream release.
* Fri Jan 28 2011 Philipp Reisner <phil@linbit.com> - 8.3.10-1
- New upstream release.
* Fri Oct 22 2010 Philipp Reisner <phil@linbit.com> - 8.3.9-1
- New upstream release.
* Wed Jun 2 2010 Philipp Reisner <phil@linbit.com> - 8.3.8-1
- New upstream release.
* Thu Jan 13 2010 Philipp Reisner <phil@linbit.com> - 8.3.7-1
- New upstream release.
* Thu Nov 8 2009 Philipp Reisner <phil@linbit.com> - 8.3.6-1
- New upstream release.
* Thu Oct 27 2009 Philipp Reisner <phil@linbit.com> - 8.3.5-1
- New upstream release.
* Wed Oct 21 2009 Florian Haas <florian@linbit.com> - 8.3.4-12
- Packaging makeover.
* Thu Oct 6 2009 Philipp Reisner <phil@linbit.com> - 8.3.4-1
- New upstream release.
* Thu Oct 5 2009 Philipp Reisner <phil@linbit.com> - 8.3.3-1
- New upstream release.
* Fri Jul 3 2009 Philipp Reisner <phil@linbit.com> - 8.3.2-1
- New upstream release.
* Fri Mar 27 2009 Philipp Reisner <phil@linbit.com> - 8.3.1-1
- New upstream release.
* Thu Dec 18 2008 Philipp Reisner <phil@linbit.com> - 8.3.0-1
- New upstream release.
* Thu Nov 12 2008 Philipp Reisner <phil@linbit.com> - 8.2.7-1
- New upstream release.
* Fri May 30 2008 Philipp Reisner <phil@linbit.com> - 8.2.6-1
- New upstream release.
* Tue Feb 12 2008 Philipp Reisner <phil@linbit.com> - 8.2.5-1
- New upstream release.
* Fri Jan 11 2008 Philipp Reisner <phil@linbit.com> - 8.2.4-1
- New upstream release.
* Wed Jan 9 2008 Philipp Reisner <phil@linbit.com> - 8.2.3-1
- New upstream release.
* Fri Nov 2 2007 Philipp Reisner <phil@linbit.com> - 8.2.1-1
- New upstream release.
* Fri Sep 28 2007 Philipp Reisner <phil@linbit.com> - 8.2.0-1
- New upstream release.
* Mon Sep 3 2007 Philipp Reisner <phil@linbit.com> - 8.0.6-1
- New upstream release.
* Fri Aug 3 2007 Philipp Reisner <phil@linbit.com> - 8.0.5-1
- New upstream release.
* Wed Jun 27 2007 Philipp Reisner <phil@linbit.com> - 8.0.4-1
- New upstream release.
* Mon May 7 2007 Philipp Reisner <phil@linbit.com> - 8.0.3-1
- New upstream release.
* Fri Apr 6 2007 Philipp Reisner <phil@linbit.com> - 8.0.2-1
- New upstream release.
* Mon Mar 3 2007 Philipp Reisner <phil@linbit.com> - 8.0.1-1
- New upstream release.
* Wed Jan 24 2007 Philipp Reisner <phil@linbit.com> - 8.0.0-1
- New upstream release.

View File

@ -0,0 +1,17 @@
[Unit]
Description=Control drbd resources.
After=network.target sshd.service
[Service]
Type=forking
Restart=no
KillMode=process
RemainAfterExit=yes
ExecStart=/etc/rc.d/init.d/drbd start
ExecStop=/etc/rc.d/init.d/drbd stop
ExecReload=/etc/rc.d/init.d/drbd reload
TimeoutSec=5min
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,18 @@
---
scripts/drbd | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -185,7 +185,10 @@ case "$1" in
done
[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
- $DRBDADM wait-con-int # User interruptible version of wait-connect all
+
+ if [ ! -e /etc/platform/simplex ] ; then # Skip if simplex
+ $DRBDADM wait-con-int # User interruptible version of wait-connect all
+ fi
$DRBDADM sh-b-pri all # Become primary if configured
log_end_msg 0

View File

@ -0,0 +1,26 @@
Index: drbd-8.3.11/scripts/drbd.ocf
===================================================================
--- drbd-8.3.11.orig/scripts/drbd.ocf
+++ drbd-8.3.11/scripts/drbd.ocf
@@ -202,13 +202,17 @@ do_drbdadm() {
}
set_master_score() {
- # Use quiet mode (-Q) to quench logging. Actual score updates
- # will get logged by attrd anyway
- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
+ if [ -x ${HA_SBIN_DIR}/crm_master ]; then
+ # Use quiet mode (-Q) to quench logging. Actual score updates
+ # will get logged by attrd anyway
+ do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
+ fi
}
remove_master_score() {
- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
+ if [ -x ${HA_SBIN_DIR}/crm_master ]; then
+ do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
+ fi
}
_sh_status_process() {

View File

@ -0,0 +1,387 @@
---
scripts/drbd | 1
scripts/drbd.ocf | 259 ++++++++++++++++++++++---------------------------------
2 files changed, 109 insertions(+), 151 deletions(-)
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -5,6 +5,8 @@
#
# Copyright (c) 2009 LINBIT HA-Solutions GmbH,
# Copyright (c) 2009 Florian Haas, Lars Ellenberg
+# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
+#
# Based on the Heartbeat drbd OCF Resource Agent by Lars Marowsky-Bree
# (though it turned out to be an almost complete rewrite)
#
@@ -216,20 +218,6 @@ do_drbdadm() {
return $ret
}
-set_master_score() {
- if [ -x ${HA_SBIN_DIR}/crm_master ]; then
- # Use quiet mode (-Q) to quench logging. Actual score updates
- # will get logged by attrd anyway
- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1
- fi
-}
-
-remove_master_score() {
- if [ -x ${HA_SBIN_DIR}/crm_master ]; then
- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
- fi
-}
-
_sh_status_process() {
# _volume not present should not happen,
# but may help make this agent work even if it talks to drbd 8.3.
@@ -242,6 +230,7 @@ _sh_status_process() {
DRBD_DSTATE_LOCAL[$_volume]=${_disk:-Unconfigured}
DRBD_DSTATE_REMOTE[$_volume]=${_pdsk:-DUnknown}
}
+
drbd_set_status_variables() {
# drbdsetup sh-status prints these values to stdout,
# and then prints _sh_status_process.
@@ -322,119 +311,9 @@ maybe_outdate_self()
ocf_log notice "outdating $DRBD_RESOURCE: according to OCF_RESKEY_CRM_meta_notify_master_uname, '$host' is still master"
do_drbdadm outdate $DRBD_RESOURCE
- # on some pacemaker versions, -INFINITY may cause resource instance stop/start.
- # But in this case that is ok, it may even clear the replication link
- # problem.
- set_master_score -INFINITY
-
return 0
}
-drbd_update_master_score() {
- # NOTE
- # there may be constraint scores from rules on role=Master,
- # that in some ways can add to the node attribute based master score we
- # specify below. If you think you want to add personal preferences,
- # in case the scores given by this RA do not suffice, this is the
- # value space you can work with:
- # -INFINITY: Do not promote. Really. Won't work anyways.
- # Too bad, at least with current (Oktober 2009) Pacemaker,
- # negative master scores cause instance stop; restart cycle :(
- # missing, zero: Do not promote.
- # I think my data is not good enough.
- # Though, of course, you may try, and it might even work.
- # 5: please, do not promote, unless this is your only option.
- # 10: promotion is probably a bad idea, our local data is no good,
- # you'd probably run into severe performance problems, and risk
- # application crashes or blocking IO in case you lose the
- # replication connection.
- # 1000: Ok to be promoted, we have good data locally (though we don't
- # know about the peer, so possibly it has even better data?).
- # You sould use the crm-fence-peer.sh handler or similar
- # mechanism to avoid data divergence.
- # 10000: Please promote me/keep me Primary.
- # I'm confident that my data is as good as it gets.
- #
- # For multi volume, we need to compare who is "better" a bit more sophisticated.
- # The ${XXX[*]//UpToDate}, without being in double quotes, results in a single space,
- # if all are UpToDate.
- : == DEBUG == ${DRBD_ROLE_LOCAL[*]}/${DRBD_DSTATE_LOCAL[*]//UpToDate/ }/${DRBD_DSTATE_REMOTE[*]//UpToDate/ }/ ==
- case ${DRBD_ROLE_LOCAL[*]}/${DRBD_DSTATE_LOCAL[*]//UpToDate/ }/${DRBD_DSTATE_REMOTE[*]//UpToDate/ }/ in
- *Primary*/\ /*/)
- # I am Primary, all local disks are UpToDate
- set_master_score 10000
- ;;
- */\ /*DUnknown*/)
- # all local disks are UpToDate,
- # but I'm not Primary,
- # and I'm not sure about the peer's disk state(s).
- # We may need to outdate ourselves?
- # But if we outdate in a MONITOR, and are disconnected
- # secondary because of a hard primary crash, before CRM noticed
- # that there is no more master, we'd make us utterly useless!
- # Trust that the primary will also notice the disconnect,
- # and will place an appropriate fencing constraint via
- # its fence-peer handler callback.
- set_master_score 1000
- ;;
- */\ /*/)
- # We know something about our peer, which means that either the
- # replication link is established, or it was not even
- # consistent last time we talked to each other.
- # Also all our local disks are UpToDate, which means even if we are
- # currently synchronizing, we do so as SyncSource.
- set_master_score 10000
- ;;
-
- */*/\ /)
- # At least one of our local disks is not up to date.
- # But our peer is ALL OK.
- # We can expect to have access to useful
- # data, but must expect degraded performance.
- set_master_score 10
- ;;
- */*Attaching*/*/|\
- */*Negotiating*/*/)
- # some transitional state.
- # just don't do anything
- : ;;
-
- Unconfigured*|\
- */*Diskless*/*/|\
- */*Failed*/*/|\
- */*Inconsistent*/*/|\
- */*Outdated*/*/)
- # ALWAYS put the cluster in MAINTENANCE MODE
- # if you add a volume to a live replication group,
- # because the new volume will typically come up as Inconsistent
- # the first time, which would cause a monitor to revoke the
- # master score!
- #
- # At least some of our local disks are not really useable.
- # Our peer is not all good either (or some previous case block
- # would have matched). We have no access to useful data.
- # DRBD would refuse to be promoted, anyways.
- #
- # set_master_score -INFINITY
- # Too bad, at least with current (Oktober 2009) Pacemaker,
- # negative master scores cause instance stop; restart cycle :(
- # Hope that this will suffice.
- remove_master_score
- ;;
- *)
- # All local disks seem to be Consistent.
- # They _may_ be up to date, or not.
- # We hope that fencing mechanisms have put constraints in
- # place, so we won't be promoted with stale data.
- # But in case this was a cluster crash,
- # at least allow _someone_ to be promoted.
- set_master_score 5
- ;;
- esac
-
- return $OCF_SUCCESS
-}
-
is_drbd_enabled() {
test -f /proc/drbd
}
@@ -488,7 +367,103 @@ drbd_status() {
return $rc
}
-# I'm sorry, but there is no $OCF_DEGRADED_MASTER or similar yet.
+drbd_condition() {
+ local status
+ local rc
+
+ status=$1
+ rc=$status
+
+ if [ $status -ne $OCF_SUCCESS -a $status -ne $OCF_RUNNING_MASTER ]
+ then
+ return $rc
+ fi
+
+ drbd_set_status_variables
+
+ ocf_log info "${OCF_RESKEY_drbd_resource} ${DRBD_ROLE_LOCAL}/${DRBD_DSTATE_LOCAL}/${DRBD_DSTATE_REMOTE} ${DRBD_CSTATE}"
+
+ case "${DRBD_DSTATE_LOCAL}" in
+ UpToDate)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone, attempting to reconnect."
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ #drbd-overview | grep -A 1 drbd-cgcs | grep sync\'ed | cut -f2,3 -d' '
+ ocf_log info "${OCF_RESKEY_drbd_resource} syncing"
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ Consistent)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone, attempting to reconnect"
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ ;;
+ *)
+ rc=$OCF_DATA_CONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} consistent"
+ ;;
+ esac
+ ;;
+ Outdated)
+ rc=$OCF_DATA_OUTDATED
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ ;;
+ *)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone"
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ ocf_log info "${OCF_RESKEY_drbd_resource} sync"
+ ;;
+ *)
+ rc=$OCF_DATA_INCONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} inconsistent"
+ ;;
+ esac
+ ;;
+ esac
+
+ if [ $status -eq $OCF_RUNNING_MASTER ]
+ then
+ if [ $rc -eq $OCF_DATA_INCONSISTENT ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_INCONSISTENT
+
+ elif [ $rc -eq $OCF_DATA_OUTDATED ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_OUTDATED
+
+ elif [ $rc -eq $OCF_DATA_CONSISTENT ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_CONSISTENT
+
+ elif [ $rc -eq $OCF_DATA_SYNC ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_SYNC
+
+ elif [ $rc -eq $OCF_DATA_STANDALONE ]
+ then
+ rc=$OCF_RUNNING_MASTER_DATA_STANDALONE
+ fi
+ fi
+
+ return $rc
+}
+
drbd_monitor() {
local status
@@ -501,7 +476,8 @@ drbd_monitor() {
drbd_status
status=$?
- drbd_update_master_score
+ drbd_condition $status
+ status=$?
return $status
}
@@ -578,7 +554,8 @@ drbd_start() {
# "running" already, anyways, right?
figure_out_drbd_peer_uname
do_drbdadm $DRBD_TO_PEER adjust $DRBD_RESOURCE
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
break
;;
$OCF_NOT_RUNNING)
@@ -606,9 +583,6 @@ drbd_start() {
$first_try || sleep 1
first_try=false
done
- # in case someone does not configure monitor,
- # we must at least call it once after start.
- drbd_update_master_score
return $rc
}
@@ -642,7 +616,8 @@ drbd_promote() {
break
;;
$OCF_RUNNING_MASTER)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
break
esac
$first_try || sleep 1
@@ -666,7 +641,8 @@ drbd_demote() {
status=$?
case "$status" in
$OCF_SUCCESS)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
break
;;
$OCF_NOT_RUNNING)
@@ -718,14 +694,9 @@ drbd_stop() {
# outdate myself in drbd on-disk meta data.
maybe_outdate_self
- # do not let old master scores laying around.
- # they may confuse crm if this node was set to standby.
- remove_master_score
-
return $rc
}
-
drbd_notify() {
local n_type=$OCF_RESKEY_CRM_meta_notify_type
local n_op=$OCF_RESKEY_CRM_meta_notify_operation
@@ -760,7 +731,6 @@ drbd_notify() {
# After something has been done is a good time to
# recheck our status:
drbd_set_status_variables
- drbd_update_master_score
: == DEBUG == ${DRBD_DSTATE_REMOTE[*]} ==
case ${DRBD_DSTATE_REMOTE[*]} in
@@ -793,17 +763,6 @@ ls_stat_is_block_maj_147() {
[[ $1 = b* ]] && [[ $5 == 147,* ]]
}
-check_crm_feature_set()
-{
- set -- ${OCF_RESKEY_crm_feature_set//[!0-9]/ }
- local a=${1:-0} b=${2:-0} c=${3:-0}
-
- (( a > 3 )) ||
- (( a == 3 && b > 0 )) ||
- (( a == 3 && b == 0 && c > 0 )) ||
- ocf_log warn "You may be disappointed: This RA is intended for pacemaker 1.0 or better!"
-}
-
drbd_validate_all () {
DRBDADM="drbdadm"
DRBDSETUP="drbdsetup"
@@ -821,7 +780,6 @@ drbd_validate_all () {
if (( $DRBDADM_VERSION_CODE >= 0x080400 )); then
DRBD_HAS_MULTI_VOLUME=true
fi
- check_crm_feature_set
# Check clone and M/S options.
meta_expect clone-max -le 2
@@ -890,7 +848,6 @@ drbd_validate_all () {
# hm. probably misconfigured constraint somewhere.
# sorry. don't retry anywhere.
ocf_log err "DRBD resource ${DRBD_RESOURCE} not found in configuration file ${OCF_RESKEY_drbdconf}."
- remove_master_score
return $OCF_ERR_INSTALLED
fi
fi
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -4,6 +4,7 @@
# description: Loads and unloads the drbd module
#
# Copyright 2001-2010 LINBIT
+# Copyright (c) 2014 Wind River Systems, Inc. All rights reserved.
#
# Philipp Reisner, Lars Ellenberg
#

View File

@ -0,0 +1,132 @@
Index: git/user/drbdadm_adjust.c
===================================================================
--- git.orig/user/drbdadm_adjust.c
+++ git/user/drbdadm_adjust.c
@@ -157,6 +157,7 @@ static int opts_equal(struct context_def
static int addr_equal(struct d_resource* conf, struct d_resource* running)
{
int equal;
+ char *peer_addr, *peer_af, *peer_port;
if (conf->peer == NULL && running->peer == NULL) return 1;
if (running->peer == NULL) return 0;
@@ -165,16 +166,29 @@ static int addr_equal(struct d_resource*
!strcmp(conf->me->port, running->me->port) &&
!strcmp(conf->me->address_family, running->me->address_family);
- if(conf->me->proxy)
- equal = equal &&
- !strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
- !strcmp(conf->me->proxy->inside_port, running->peer->port) &&
- !strcmp(conf->me->proxy->inside_af, running->peer->address_family);
- else
- equal = equal && conf->peer &&
- !strcmp(conf->peer->address, running->peer->address) &&
- !strcmp(conf->peer->port, running->peer->port) &&
- !strcmp(conf->peer->address_family, running->peer->address_family);
+ if(conf->me->proxy) {
+ peer_addr = conf->me->proxy->inside_addr;
+ peer_port = conf->me->proxy->inside_port;
+ peer_af = conf->me->proxy->inside_af;
+ } else {
+ peer_addr = conf->peer->address;
+ peer_port = conf->peer->port;
+ peer_af = conf->peer->address_family;
+ }
+
+ equal = equal && conf->peer &&
+ !strcmp(peer_addr, running->peer->address) &&
+ !strcmp(peer_port, running->peer->port) &&
+ !strcmp(peer_af, running->peer->address_family);
+
+ if (verbose > 2)
+ fprintf(stderr, "Network addresses differ:\n"
+ "\trunning: %s:%s:%s -- %s:%s:%s\n"
+ "\t config: %s:%s:%s -- %s:%s:%s\n",
+ running->me->address_family, running->me->address, running->me->port,
+ running->peer->address_family, running->peer->address, running->peer->port,
+ conf->me->address_family, conf->me->address, conf->me->port,
+ peer_af, peer_addr, peer_port);
return equal;
}
@@ -690,8 +704,7 @@ int adm_adjust(struct cfg_ctx *ctx)
if (ctx->res->me->proxy && can_do_proxy)
do_connect |= proxy_reconf(ctx, running);
- if (do_connect && running)
- do_disconnect = running->net_options != NULL;
+ do_disconnect = do_connect && running && (running->peer || running->net_options);
if (do_res_options)
schedule_deferred_cmd(adm_set_default_res_options, ctx, "resource-options", CFG_RESOURCE);
@@ -716,8 +729,12 @@ int adm_adjust(struct cfg_ctx *ctx)
}
if (do_connect) {
- if (do_disconnect && ctx->res->peer)
- schedule_deferred_cmd(adm_disconnect, ctx, "disconnect", CFG_NET_PREREQ);
+ /* "disconnect" specifying the end-point addresses currently in-use,
+ * before "connect"ing with the addresses currently in-config-file. */
+ if (do_disconnect) {
+ struct cfg_ctx tmp_ctx = { .res = running, .vol = vol, };
+ schedule_deferred_cmd(adm_disconnect, &tmp_ctx, "disconnect", CFG_NET_PREREQ);
+ }
schedule_deferred_cmd(adm_connect, ctx, "connect", CFG_NET);
do_net_options = 0;
}
Index: git/user/legacy/drbdadm_adjust.c
===================================================================
--- git.orig/user/legacy/drbdadm_adjust.c
+++ git/user/legacy/drbdadm_adjust.c
@@ -133,6 +133,7 @@ static int opts_equal(struct d_option* c
static int addr_equal(struct d_resource* conf, struct d_resource* running)
{
int equal;
+ char *peer_addr, *peer_af, *peer_port;
if (conf->peer == NULL && running->peer == NULL) return 1;
if (running->peer == NULL) return 0;
@@ -141,18 +142,31 @@ static int addr_equal(struct d_resource*
!strcmp(conf->me->port, running->me->port) &&
!strcmp(conf->me->address_family, running->me->address_family);
- if(conf->me->proxy)
- equal = equal &&
- !strcmp(conf->me->proxy->inside_addr, running->peer->address) &&
- !strcmp(conf->me->proxy->inside_port, running->peer->port) &&
- !strcmp(conf->me->proxy->inside_af, running->peer->address_family);
- else
- equal = equal && conf->peer &&
- !strcmp(conf->peer->address, running->peer->address) &&
- !strcmp(conf->peer->port, running->peer->port) &&
- !strcmp(conf->peer->address_family, running->peer->address_family);
+ if(conf->me->proxy) {
+ peer_addr = conf->me->proxy->inside_addr;
+ peer_port = conf->me->proxy->inside_port;
+ peer_af = conf->me->proxy->inside_af;
+ } else {
+ peer_addr = conf->peer->address;
+ peer_port = conf->peer->port;
+ peer_af = conf->peer->address_family;
+ }
+
+ equal = equal && conf->peer &&
+ !strcmp(peer_addr, running->peer->address) &&
+ !strcmp(peer_port, running->peer->port) &&
+ !strcmp(peer_af, running->peer->address_family);
+
+ if (verbose > 2)
+ fprintf(stderr, "Network addresses differ:\n"
+ "\trunning: %s:%s:%s -- %s:%s:%s\n"
+ "\t config: %s:%s:%s -- %s:%s:%s\n",
+ running->me->address_family, running->me->address, running->me->port,
+ running->peer->address_family, running->peer->address, running->peer->port,
+ conf->me->address_family, conf->me->address, conf->me->port,
+ peer_af, peer_addr, peer_port);
- return equal;
+ return equal;
}
static int proto_equal(struct d_resource* conf, struct d_resource* running)

View File

@ -0,0 +1,34 @@
Index: git/scripts/drbd.ocf
===================================================================
--- git.orig/scripts/drbd.ocf
+++ git/scripts/drbd.ocf
@@ -418,6 +418,29 @@ drbd_condition() {
rc=$OCF_DATA_OUTDATED
ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
;;
+ Inconsistent)
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ if [ $status -eq $OCF_SUCCESS ]
+ then
+ ocf_log info "${OCF_RESKEY_drbd_resource} standby standalone, attempting to reconnect."
+ do_drbdadm connect ${OCF_RESKEY_drbd_resource}
+ else
+ ocf_log info "${OCF_RESKEY_drbd_resource} standalone"
+ fi
+ ;;
+ StartingSyncT | WFBitMapT | WFSyncUUID | SyncTarget | \
+ PausedSyncT)
+ rc=$OCF_DATA_SYNC
+ ocf_log info "${OCF_RESKEY_drbd_resource} sync"
+ ;;
+ *)
+ rc=$OCF_DATA_INCONSISTENT
+ ocf_log info "${OCF_RESKEY_drbd_resource} inconsistent"
+ ;;
+ esac
+ ;;
*)
case "${DRBD_CSTATE}" in
StandAlone)

View File

@ -0,0 +1,55 @@
From ea19e3020367cfaf6da20dd690433ee72a24120c Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Mon, 2 May 2016 15:17:54 -0400
Subject: [PATCH 1/1] Avoid kernel/userspace version check
---
user/drbdadm_usage_cnt.c | 32 +-------------------------------
1 file changed, 1 insertion(+), 31 deletions(-)
diff --git a/user/drbdadm_usage_cnt.c b/user/drbdadm_usage_cnt.c
index ff6d5c8..c6cb4ad 100644
--- a/user/drbdadm_usage_cnt.c
+++ b/user/drbdadm_usage_cnt.c
@@ -244,37 +244,7 @@ static int vcs_ver_cmp(struct vcs_rel *rev1, struct vcs_rel *rev2)
void warn_on_version_mismatch(void)
{
- char *msg;
- int cmp;
-
- /* get the kernel module version from /proc/drbd */
- vcs_get_current();
-
- /* get the userland version from REL_VERSION */
- vcs_get_userland();
-
- cmp = vcs_ver_cmp(&userland_version, &current_vcs_rel);
- /* no message if equal */
- if (cmp == 0)
- return;
- if (cmp > 0xffff || cmp < -0xffff) /* major version differs! */
- msg = "mixing different major numbers will not work!";
- else if (cmp < 0) /* userland is older. always warn. */
- msg = "you should upgrade your drbd tools!";
- else if (cmp & 0xff00) /* userland is newer minor version */
- msg = "please don't mix different DRBD series.";
- else /* userland is newer, but only differ in sublevel. */
- msg = "preferably kernel and userland versions should match.";
-
- fprintf(stderr, "DRBD module version: %u.%u.%u\n"
- " userland version: %u.%u.%u\n%s\n",
- current_vcs_rel.version.major,
- current_vcs_rel.version.minor,
- current_vcs_rel.version.sublvl,
- userland_version.version.major,
- userland_version.version.minor,
- userland_version.version.sublvl,
- msg);
+ return;
}
void add_lib_drbd_to_path(void)
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 5677e262d5b3f5ecc114f1aace4ffd77a7772282 Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Tue, 21 Feb 2017 12:37:02 -0500
Subject: [PATCH] Update OCF to attempt connect in certain states
---
scripts/drbd.ocf | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 0e26ea9..84332b0 100644
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -415,8 +415,21 @@ drbd_condition() {
esac
;;
Outdated)
- rc=$OCF_DATA_OUTDATED
- ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ case "${DRBD_CSTATE}" in
+ StandAlone)
+ rc=$OCF_DATA_STANDALONE
+ if [ $status -eq $OCF_SUCCESS ]
+ then
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated standalone, attempting to reconnect."
+ do_drbdadm -- --discard-my-data connect ${OCF_RESKEY_drbd_resource}
+ else
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ fi
+ ;;
+ *)
+ rc=$OCF_DATA_OUTDATED
+ ocf_log info "${OCF_RESKEY_drbd_resource} outdated"
+ esac
;;
Inconsistent)
case "${DRBD_CSTATE}" in
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 100b44d99b0bcbac92abd2122becbfd88d155e09 Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Wed, 22 Nov 2017 20:45:28 -0500
Subject: [PATCH] Increase short cmd timeout to 15 secs
---
user/drbdadm_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/user/drbdadm_main.c b/user/drbdadm_main.c
index b89e91a..19c5a44 100644
--- a/user/drbdadm_main.c
+++ b/user/drbdadm_main.c
@@ -1467,7 +1467,7 @@ void m__system(char **argv, int flags, const char *res_name, pid_t *kid, int *fd
alarm_raised = 0;
switch (flags & SLEEPS_MASK) {
case SLEEPS_SHORT:
- timeout = 5;
+ timeout = 15;
break;
case SLEEPS_LONG:
timeout = COMM_TIMEOUT + 1;
--
1.8.3.1