DRBD upversion from 8.4 to 9.15

- Upversion code tar from 8.4 to 9.15
- Modify drbd.spec to apply code patches
- Porting 8.4 code patches to 9.15
  (Combine several current patches by target file)
Test
- drbd resize operation. Ensure no outstanding alarms
  and drbd-overview indicates insync; and 'sudo lvs'
  indicates resized correctly
- drbd resize operation prior to upgrade and then
  performing the upgrade.
  e.g. drbd may be resized via
       'system controllerfs-modify etcd=<largervalue>',
       when both controllers are
       unlocked-enabled-available

Story: 2009067
Task: 42873

Depends-On: https://review.opendev.org/806736
Signed-off-by: Takamasa Takenaka <takamasa.takenaka@windriver.com>
Change-Id: I25cb46e4b77f90c91d5d7e4dcfa79125776163d1
This commit is contained in:
Takamasa Takenaka 2021-07-21 16:19:51 -03:00
parent 5997bdc453
commit b24095eccc
20 changed files with 1061 additions and 1002 deletions

View File

@ -13,7 +13,7 @@ docker-distribution-v2.7.1.tar.gz#docker-distribution-2.7.1#https://github.com/d
dpdk-18.11.tar.xz#dpdk-18.11#http://fast.dpdk.org/rel/dpdk-18.11.tar.xz#http##
dpdk-6ece49ad5a26f5e2f5c4af6c06c30376c0ddc387.tar.gz#dpdk#https://api.github.com/repos/spdk/dpdk/tarball/6ece49ad5a26f5e2f5c4af6c06c30376c0ddc387#https##
dpkg_1.18.24.tar.xz#dpkg-1.18.24#http://http.debian.net/debian/pool/main/d/dpkg/dpkg_1.18.24.tar.xz#http##
drbd-8.4.3.tar.gz#drbd-8.4.3#http://www.linbit.com/downloads/drbd/8.4/archive/drbd-8.4.3.tar.gz#http##
drbd-utils-9.15.1.tar.gz#drbd-utils-9.15.1#https://pkg.linbit.com//downloads/drbd/utils/drbd-utils-9.15.1.tar.gz#https##
dtc-1.4.4.tar.gz#dtc-1.4.4#https://www.kernel.org/pub/software/utils/dtc/dtc-1.4.4.tar.gz#http##
etcd-v3.3.15.tar.gz#etcd-v3.3.15#https://github.com/etcd-io/etcd/archive/v3.3.15.tar.gz#http##
gf-complete-7e61b44404f0ed410c83cfd3947a52e88ae044e1.tar.gz#gf-complete#https://api.github.com/repos/ceph/gf-complete/tarball/7e61b44404f0ed410c83cfd3947a52e88ae044e1#https##

View File

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

View File

@ -10,72 +10,100 @@
%{!?with: %{expand: %%global with() %%{expand:%%%%{?with_%%{1}:1}%%%%{!?with_%%{1}:0}}}}
%{!?without: %{expand: %%global without() %%{expand:%%%%{?with_%%{1}:0}%%%%{!?with_%%{1}:1}}}}
%if 0%{!?initscripttype:1}
# initscripttype not explicitly defined in some macro file or on commandline
# use presence of systemd_post macro to determine the initscripttype
%if %{?systemd_post:1}%{!?systemd_post:0}
%global initscripttype systemd
%else
%global initscripttype sysv
%endif
%endif
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features
%bcond_without manual
%bcond_without udev
%bcond_without pacemaker
%bcond_with rgmanager
%bcond_without heartbeat
# conditionals may not contain "-" nor "_", hence "bashcompletion"
%bcond_without bashcompletion
%bcond_without sbinsymlinks
# --with xen is ignored on any non-x86 architecture
%bcond_without xen
%bcond_without legacy_utils
#%ifnarch %{ix86} x86_64
%bcond_without 83support
%bcond_without 84support
%bcond_without drbdmon
%bcond_with prebuiltman
%ifnarch %{ix86} x86_64
%global _without_xen --without-xen
#%endif
%endif
# Set system type
%global initscripttype sysv
# remove unnesessary features
%global _without_xen --without-xen
%undefine with_xen
%undefine with_sbinsymlinks
Name: drbd
Summary: DRBD driver for Linux
Version: 8.4.3
Version: 9.15.1
Release: 0%{?_tis_dist}.%{tis_patch_ver}
Source: http://oss.linbit.com/%{name}/8.3/%{name}-%{version}.tar.gz
Source: http://www.drbd.org/download/drbd/utils/drbd-utils-%{version}.tar.gz
Source1: drbd.service
# StarlingX
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
Patch0009: 0009-Check-for-mounted-device-before-demoting-Primary-DRB.patch
Patch0010: 0010-backport-drbd-main-ipv6-Fix-interface-indices-larger.patch
Patch0011: 0011-Unmount-all-targets-during-drbd-stop.patch
Patch0012: 0012-netlink-prepare-for-kernel-v5.2.patch
Patch0013: 0013-netlink-Add-NLA_F_NESTED-flag-to-nested-attribute.patch
Patch0001: 0001_915-drbd-script.patch
Patch0002: 0002_915-drbd_ocf.patch
Patch0003: 0003_915-avoid-kernel-userspace-version-check.patch
Patch0004: 0004_915-Increase-short-cmd-timeout-to-15-secs.patch
Patch0005: 0005_915-drbd-overview.patch
License: GPLv2+
ExclusiveOS: linux
Group: System Environment/Kernel
URL: http://www.drbd.org/
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRoot: %(mktemp -ud %{_tmppath}/drbd-utils-%{version}-%{release}-XXXXXX)
BuildRequires: flex
Requires: %{name}-utils = %{version}
Requires: drbd-utils = %{version}
%ifarch %{ix86} x86_64
%if %{with xen}
Requires: drbd-xen = %{version}
%endif
%endif
%if %{with udev}
Requires: %{name}-udev = %{version}
Requires: drbd-udev = %{version}
BuildRequires: udev
%endif
%if %{with pacemaker}
Requires: %{name}-pacemaker = %{version}
Requires: drbd-pacemaker = %{version}
%endif
%if %{with drbdmon}
BuildRequires: gcc-c++
%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}
## Requires: drbd-rgmanager = %{version}
## %endif
##
## ## Neither do we want to force anyone to install heartbeat
## ## Usually they use corosync meanwhile.
## ## No need to pull in heartbeat via the drbd-heartbeat scripts
## ## meant for haresources mode
## %if %{with heartbeat}
## Requires: %{name}-heartbeat = %{version}
## %endif
%if %{with heartbeat}
Requires: %{name}-heartbeat = %{version}
%endif
%if %{with bashcompletion}
Requires: %{name}-bash-completion = %{version}
Requires: drbd-bash-completion = %{version}
%endif
BuildRequires: systemd-devel
BuildRequires: automake
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description
DRBD mirrors a block device over the network to another machine.
@ -90,19 +118,41 @@ This is a virtual package, installing the full DRBD userland suite.
%defattr(-,root,root,-)
%doc COPYING
%doc ChangeLog
%doc README
%doc README.md
%package utils
Summary: Management utilities for DRBD
Group: System Environment/Kernel
# Our kernel modules "require" specific drbd-utils versions, not ranges.
# Which was natural as long as userland and module shared the same repo
# and source tarball, and would be build together.
#
# Now we split the userland part, we "provide" a list of versions here,
# to be able to use this package with existing module packages.
#
%if %{with 84support}
# which 8.4 version equivalent this package provides
Provides: drbd-utils = 8.4.5
Provides: drbd-utils = 8.4.4
Provides: drbd-utils = 8.4.3
Provides: drbd-utils = 8.4.2
Provides: drbd-utils = 8.4.1
Provides: drbd-utils = 8.4.0
%endif
%if %{with 83support}
# which 8.3 version equivalent this package provides
Provides: drbd-utils = 8.3.16
%endif
# 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
%if %{initscripttype} == "sysv"
Requires(post): chkconfig
Requires(preun): chkconfig
%endif
%description utils
DRBD mirrors a block device over the network to another machine.
@ -113,51 +163,100 @@ This packages includes the DRBD administration tools.
%files utils
%defattr(755,root,root,-)
%if %{with sbinsymlinks}
/sbin/drbdsetup
/sbin/drbdadm
/sbin/drbdmeta
%if %{with legacy_utils}
%endif
%{_sbindir}/drbdsetup
%{_sbindir}/drbdadm
%{_sbindir}/drbdmeta
%if %{with 83support}
%dir /lib/drbd/
/lib/drbd/drbdsetup-83
/lib/drbd/drbdadm-83
%endif
%{_initddir}/%{name}
%attr(644,root,root) %{_unitdir}/%{name}.service
%if %{with 84support}
/lib/drbd/drbdsetup-84
/lib/drbd/drbdadm-84
%endif
%if %{with drbdmon}
%{_sbindir}/drbdmon
%endif
%{_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
%if %{initscripttype} == "sysv"
%{_initddir}/drbd
%endif
%attr(644,root,root) %{_unitdir}/drbd.service
%attr(755,root,root) %{_sbindir}/drbd-overview
%dir %{_prefix}/lib/drbd
%{_prefix}/lib/drbd/outdate-peer.sh
%{_prefix}/lib/drbd/snapshot-resync-target-lvm.sh
%{_prefix}/lib/drbd/unsnapshot-resync-target-lvm.sh
%{_prefix}/lib/drbd/notify-out-of-sync.sh
%{_prefix}/lib/drbd/notify-split-brain.sh
%{_prefix}/lib/drbd/notify-emergency-reboot.sh
%{_prefix}/lib/drbd/notify-emergency-shutdown.sh
%{_prefix}/lib/drbd/notify-io-error.sh
%{_prefix}/lib/drbd/notify-pri-lost-after-sb.sh
%{_prefix}/lib/drbd/notify-pri-lost.sh
%{_prefix}/lib/drbd/notify-pri-on-incon-degr.sh
%{_prefix}/lib/drbd/notify.sh
%dir %{_var}/lib/drbd
%ghost %dir %{_var}/run/drbd
%defattr(-,root,root,-)
%dir %{_var}/lib/%{name}
%if %{initscripttype} == "systemd"
%{_unitdir}/drbd.service
%{_tmpfilesdir}/drbd.conf
/lib/drbd/drbd
%endif
%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.*
%config(noreplace) %{_sysconfdir}/multipath/conf.d/drbd.conf
%if %{with manual}
%{_mandir}/man8/drbd-*
%{_mandir}/man8/drbdsetup-*
%{_mandir}/man8/drbdadm-*
%{_mandir}/man7/ocf_linbit_drbd.*
%{_mandir}/man7/ocf_linbit_drbd-attr.*
%{_mandir}/man5/drbd.conf-*
%{_mandir}/man8/drbdmeta-*
%if %{with drbdmon}
%{_mandir}/man8/drbdmon-*
%endif
%endif
%doc scripts/drbd.conf.example
%doc COPYING
%doc ChangeLog
%doc README
%doc README.md
%ifarch %{ix86} x86_64
%if %{with xen}
%package xen
Summary: Xen block device management script for DRBD
Group: System Environment/Kernel
Requires: drbd-utils = %{version}-%{release}
@RPM_REQ_XEN@
@RPM_SUBPACKAGE_NOARCH@
%description xen
This package contains a Xen block device helper script for DRBD, capable of
promoting and demoting DRBD resources as necessary.
%files xen
%defattr(755,root,root,-)
%{_sysconfdir}/xen/scripts/block-drbd
%endif # with xen
%endif # arch %{ix86} x86_64
%if %{with udev}
%package udev
Summary: udev integration scripts for DRBD
Group: System Environment/Kernel
Requires: %{name}-utils = %{version}-%{release}, udev
Requires: drbd-utils = %{version}-%{release}, udev
#@RPM_SUBPACKAGE_NOARCH@
%description udev
This package contains udev helper scripts for DRBD, managing symlinks to
@ -165,15 +264,17 @@ 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*
%config(noreplace) %{_udevrulesdir}/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}
Requires: drbd-utils = %{version}-%{release}
#@RPM_REQ_PACEMAKER@
License: GPLv2
#@RPM_SUBPACKAGE_NOARCH@
%description pacemaker
This package contains the master/slave DRBD resource agent for the
@ -181,10 +282,14 @@ 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/drbd/crm-fence-peer.sh
%{_prefix}/lib/drbd/crm-fence-peer.9.sh
%{_prefix}/lib/drbd/crm-unfence-peer.sh
%{_prefix}/lib/drbd/crm-unfence-peer.9.sh
%{_prefix}/lib/drbd/stonith_admin-fence-peer.sh
%{_prefix}/lib/ocf/resource.d/linbit/drbd
%{_prefix}/lib/ocf/resource.d/linbit/drbd-attr
%{_prefix}/lib/ocf/resource.d/linbit/drbd.shellfuncs.sh
%endif # with pacemaker
# Dependencies for drbd-rgmanager are particularly awful. On RHEL 5
@ -212,7 +317,8 @@ Pacemaker High Availability cluster manager.
%package rgmanager
Summary: Red Hat Cluster Suite agent for DRBD
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
Requires: drbd-utils = %{version}-%{release}
#@RPM_SUBPACKAGE_NOARCH@
%description rgmanager
This package contains the DRBD resource agent for the Red Hat Cluster Suite
@ -224,18 +330,21 @@ in the Cluster distribution.
%files rgmanager
%defattr(755,root,root,-)
%{_datadir}/cluster/drbd.sh
%{_prefix}/lib/%{name}/rhcs_fence
%{_prefix}/lib/drbd/rhcs_fence
%defattr(-,root,root,-)
%{_datadir}/cluster/drbd.metadata
%endif # with rgmanager
%if %{with 84support}%{with 83support}
%if %{with heartbeat}
%package heartbeat
Summary: Heartbeat resource agent for DRBD
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
#@RPM_REQ_HEARTBEAT@
License: GPLv2
#@RPM_SUBPACKAGE_NOARCH@
%description heartbeat
This package contains the DRBD resource agents for the Heartbeat cluster
@ -247,14 +356,19 @@ resource manager (in v1 compatibility mode).
%{_sysconfdir}/ha.d/resource.d/drbdupper
%defattr(-,root,root,-)
%{_mandir}/man8/drbddisk.8.*
%if %{with manual}
%{_mandir}/man8/drbddisk-*
%endif
%endif # with heartbeat
%endif # 83 || 84 support
%if %{with bashcompletion}
%package bash-completion
Summary: Programmable bash completion support for drbdadm
Group: System Environment/Base
Requires: %{name}-utils = %{version}-%{release}
Requires: drbd-utils = %{version}-%{release}
#@RPM_REQ_BASH_COMPLETION@
#@RPM_SUBPACKAGE_NOARCH@
%description bash-completion
This package contains programmable bash completion support for the drbdadm
@ -265,49 +379,120 @@ management utility.
%config(noreplace) %{_sysconfdir}/bash_completion.d/drbdadm*
%endif # with bashcompletion
%if %{with manual}
%package man-ja
Summary: Japanese man pages for DRBD
Group: System Environment/Base
%if %{without prebuiltman}
BuildRequires: po4a
%endif
#@RPM_SUBPACKAGE_NOARCH@
%description man-ja
This package contains Japanese man pages for DRBD.
%files man-ja
%defattr(-,root,root,-)
%{_mandir}/ja/man8/drbd-*
%{_mandir}/ja/man8/drbdsetup-*
%{_mandir}/ja/man8/drbdadm-*
%{_mandir}/ja/man5/drbd.conf-*
%{_mandir}/ja/man8/drbdmeta-*
%if %{with heartbeat}
%if %{with 84support}
%{_mandir}/ja/man8/drbddisk-*
%endif
%endif # with heartbeat
%if %{with drbdmon}
%{_mandir}/ja/man8/drbdmon-*
%endif
%post man-ja
for f in drbd drbdadm drbdmeta drbdsetup; do
ln -sf $f-8.4.8.gz %{_mandir}/ja/man8/$f.8.gz
done
ln -sf drbd.conf-8.4.5.gz %{_mandir}/ja/man5/drbd.conf.5.gz
%if %{with drbdmon}
ln -sf drbdmon-9.0.8.gz %{_mandir}/ja/man8/drbdmon.8.gz
%endif
%preun man-ja
for f in drbd drbdadm drbdmeta drbdsetup; do
rm -f %{_mandir}/ja/man8/$f.8.gz
done
rm -f %{_mandir}/ja/man5/drbd.conf.5.gz
rm -f %{_mandir}/ja/man8/drbdmon.8.gz
%endif # with manual
%prep
%setup -q
%setup -q -n drbd-utils-%{version}
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch0011 -p1
%patch0012 -p1
%patch0013 -p1
%build
# rebuild configure...
aclocal
autoheader
autoconf
%configure \
--with-utils \
--without-km \
%{?_without_udev} \
%{?_without_xen} \
%{?_without_pacemaker} \
%{?_without_heartbeat} \
%{?_with_rgmanager} \
%{?_without_bashcompletion} \
%{?_without_legacy_utils} \
--with-initdir=%{_initddir}
%{?_without_83support} \
%{?_without_84support} \
%{?_without_manual} \
%{?_with_prebuiltman} \
--with-initdir=%{_initddir} \
%{?_tmpfilesdir:--with-tmpfilesdir=%{_tmpfilesdir}} \
--with-initscripttype=%{initscripttype} \
%{?_without_drbdmon}
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
make install DESTDIR=%{buildroot} CREATE_MAN_LINK=no
install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 -p -D %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -m 644 -p -D %{SOURCE1} %{buildroot}%{_unitdir}/drbd.service
%if %{with sbinsymlinks}
# Don't do this if you are already on a /sbin -=> /usr/sbin distro
# compat: we used to live in /sbin/
# there may be many hardcoded /sbin/drbd* out there,
# including variants of our own scripts.
mkdir -p %{buildroot}/var/run/drbd
mkdir %{buildroot}/sbin/
cd %{buildroot}/sbin/
ln -sv ..%{_sbindir}/drbdadm .
ln -sv ..%{_sbindir}/drbdmeta .
ln -sv ..%{_sbindir}/drbdsetup .
%endif
%clean
rm -rf %{buildroot}
%post utils
%if %{initscripttype} == "systemd"
%systemd_post drbd.service
%endif
%if %{initscripttype} == "sysv"
chkconfig --add drbd
%endif
%if %{with manual}
for f in drbd drbdadm drbdmeta drbdsetup; do
ln -sf $f-8.4.8.gz %{_mandir}/man8/$f.8.gz
done
ln -sf drbd.conf-8.4.5.gz %{_mandir}/man5/drbd.conf.5.gz
%if %{with drbdmon}
ln -sf drbdmon-9.0.8.gz %{_mandir}/man8/drbdmon.8.gz
%endif
%endif
%if %{without udev}
for i in `seq 0 15` ; do
test -b /dev/drbd$i || mknod -m 0660 /dev/drbd$i b 147 $i;
@ -315,103 +500,129 @@ done
%endif #without udev
%preun utils
for f in drbd drbdadm drbdmeta drbdsetup; do
rm -f %{_mandir}/man8/$f.8.gz
done
rm -f %{_mandir}/man5/drbd.conf.5.gz
rm -f %{_mandir}/man8/drbdmon.8.gz
%if %{initscripttype} == "systemd"
%systemd_preun drbd.service
%endif
%if %{initscripttype} == "sysv"
if [ $1 -eq 0 ]; then
%{_initrddir}/drbd stop >/dev/null 2>&1
/sbin/chkconfig --del drbd
fi
%endif
%if %{initscripttype} == "systemd"
%postun utils
%systemd_postun
%endif
%changelog
* Tue Feb 5 2013 Philipp Reisner <phil@linbit.com> - 8.4.3-1
* Wed Nov 04 2020 Roland Kammerer <roland.kammerer@linbit.com> - 9.15.1-1
- New upstream release
* Mon Sep 28 2020 Roland Kammerer <roland.kammerer@linbit.com> - 9.15.0-1
- New upstream release
* Wed Sep 09 2020 Roland Kammerer <roland.kammerer@linbit.com> - 9.14.0-1
- New upstream release
* Fri May 08 2020 Roland Kammerer <roland.kammerer@linbit.com> - 9.13.0-1
- New upstream release
* Tue Feb 18 2020 Roland Kammerer <roland.kammerer@linbit.com> - 9.12.0-1
- New upstream release
* Wed Oct 16 2019 Roland Kammerer <roland.kammerer@linbit.com> - 9.11.0-1
- New upstream release
* Thu Jun 13 2019 Roland Kammerer <roland.kammerer@linbit.com> - 9.10.0-1
- New upstream release
* Mon May 27 2019 Roland Kammerer <roland.kammerer@linbit.com> - 9.9.0-1
- New upstream release
* Wed Jan 16 2019 Roland Kammerer <roland.kammerer@linbit.com> - 9.8.0-1
- New upstream release
* Tue Dec 04 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.7.0-1
- New upstream release
* Mon Oct 29 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.6.0-1
- New upstream release
* Tue Jun 26 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.5.0-1
- New upstream release.
* Thu Sep 6 2012 Philipp Reisner <phil@linbit.com> - 8.4.2-1
* Tue May 08 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.4.0-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
* Tue Apr 17 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.3.1-1
- New upstream release.
* Wed Jul 15 2011 Philipp Reisner <phil@linbit.com> - 8.4.0-1
* Wed Mar 21 2018 Roland Kammerer <roland.kammerer@linbit.com> - 9.3.0-1
- New upstream release.
* Fri Jan 28 2011 Philipp Reisner <phil@linbit.com> - 8.3.10-1
* Fri Dec 22 2017 Roland Kammerer <roland.kammerer@linbit.com> - 9.2.0-1
- New upstream release.
* Fri Oct 22 2010 Philipp Reisner <phil@linbit.com> - 8.3.9-1
* Tue Aug 29 2017 Roland Kammerer <roland.kammerer@linbit.com> - 9.1.0-1
- New upstream release.
* Wed Jun 2 2010 Philipp Reisner <phil@linbit.com> - 8.3.8-1
* Fri Jun 02 2017 Lars Ellenberg <lars@linbit.com> - 9.0.0-1
- New upstream release.
* Thu Jan 13 2010 Philipp Reisner <phil@linbit.com> - 8.3.7-1
* Fri Apr 28 2017 Lars Ellenberg <lars@linbit.com> - 8.9.11-2
- fix for regression of drbd-8.4 pacemaker integration
- fix 8.4 compatibility of shipped global_common.conf
* Fri Mar 31 2017 Philipp Reisner <phil@linbit.com> - 8.9.11-1
- New upstream release.
* Thu Nov 8 2009 Philipp Reisner <phil@linbit.com> - 8.3.6-1
* Fri Dec 23 2016 Philipp Reisner <phil@linbit.com> - 8.9.10-1
- New upstream release.
* Thu Oct 27 2009 Philipp Reisner <phil@linbit.com> - 8.3.5-1
* Thu Oct 20 2016 Philipp Reisner <phil@linbit.com> - 8.9.9-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
* Tue Sep 06 2016 Philipp Reisner <phil@linbit.com> - 8.9.8-1
- New upstream release.
* Thu Oct 5 2009 Philipp Reisner <phil@linbit.com> - 8.3.3-1
* Thu Jul 14 2016 Philipp Reisner <phil@linbit.com> - 8.9.7-1
- New upstream release.
* Fri Jul 3 2009 Philipp Reisner <phil@linbit.com> - 8.3.2-1
* Wed Feb 3 2016 Roland Kammerer <roland.kammerer@linbit.com> - 8.9.6-1
- New upstream release.
* Fri Mar 27 2009 Philipp Reisner <phil@linbit.com> - 8.3.1-1
* Wed Dec 16 2015 Philipp Reisner <phil@linbit.com> - 8.9.5-1
- New upstream release.
* Thu Dec 18 2008 Philipp Reisner <phil@linbit.com> - 8.3.0-1
* Fri Sep 18 2015 Philipp Reisner <phil@linbit.com> - 8.9.4-1
- New upstream release.
* Thu Nov 12 2008 Philipp Reisner <phil@linbit.com> - 8.2.7-1
* Wed Jul 29 2015 Lars Ellenberg <lars@linbit.com> - 8.9.3-2
- fixes for regression of drbd-8.4 pacemaker integration
* Tue Jun 16 2015 Philipp Reisner <phil@linbit.com> - 8.9.3-1
- New upstream release.
* Fri May 30 2008 Philipp Reisner <phil@linbit.com> - 8.2.6-1
* Fri Apr 03 2015 Philipp Reisner <phil@linbit.com> - 8.9.2-1
- New upstream release.
* Tue Feb 12 2008 Philipp Reisner <phil@linbit.com> - 8.2.5-1
* Fri Aug 08 2014 Lars Ellenberg <lars@linbit.com> - 8.9.1-3
- some more patches had been only merged into the "9" tools,
but unfortunately not the 8.4 tool compat tools
- place udev rules into $udevdir/*rules.d*
- rebuild: fixed default in case pkg-config does not know about udevdir
- fixed udev generated "by-disk" symlinks for drbd 8.4
* Tue Aug 05 2014 Lars Ellenberg <lars@linbit.com> - 8.9.1-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
* Tue Jun 10 2014 Philipp Reisner <phil@linbit.com> - 8.9.0-1
- New upstream release.

View File

@ -1,16 +0,0 @@
diff --git a/scripts/drbd b/scripts/drbd
index f45f258..7640097 100755
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -160,7 +160,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,24 @@
diff --git a/scripts/drbd b/scripts/drbd
index 5b610f9..6fea91c 100755
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -211,7 +211,9 @@ case "$1" in
[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
run_hook start_before-wait
- $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
run_hook start
# Become primary if configured
@@ -265,7 +267,7 @@ case "$1" in
for d in /dev/drbd* ; do
[ -L "$d" ] && continue
[ -b "$d" ] || continue
- M=$(umount "$d" 2>&1)
+ M=$(umount --all-targets "$d" 2>&1)
case $M in
*" not mounted") :;;
*) stop_failed=1; echo "$M" >&2 ;;

View File

@ -1,26 +0,0 @@
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 2105209..0aa9702 100644
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -217,13 +217,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,649 @@
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index 7aafdcf..ff77c91 100755
--- 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)
#
@@ -112,15 +114,6 @@ OCF_RESKEY_require_drbd_module_version_lt_default=9.1.0
init_optional_params()
{
- remove_master_score_if_peer_primary=false
- remove_master_score_if_peer_primary_only_if_unexpected=false
- if ocf_is_true ${OCF_RESKEY_remove_master_score_if_peer_primary:=false}; then
- remove_master_score_if_peer_primary=true
- elif [[ ${OCF_RESKEY_remove_master_score_if_peer_primary} = "unexpected" ]]; then
- remove_master_score_if_peer_primary=true
- remove_master_score_if_peer_primary_only_if_unexpected=true
- fi
-
if ocf_is_true ${OCF_RESKEY_fail_promote_early_if_peer_primary:=false}; then
fail_promote_early_if_peer_primary=true
else
@@ -562,35 +555,6 @@ do_drbdadm() {
return $ret
}
-# cached value
-unset current_master_score
-get_current_master_score()
-{
- # only call crm_master once
- [[ ${current_master_score+set} ]] ||
- current_master_score=$(crm_master -q -l reboot -G 2>/dev/null)
- # return value of this function:
- # true if master_score is present
- # false if master_score is not present
- [[ $current_master_score ]]
-}
-
-set_master_score() {
- # Use quiet mode (-Q) to quench logging. Actual score updates
- # will get logged by attrd anyway
- if [[ $1 -le 0 ]]; then
- remove_master_score
- else
- do_cmd ${HA_SBIN_DIR}/crm_master -Q -l reboot -v $1 &&
- current_master_score=$1
- fi
-}
-
-remove_master_score() {
- do_cmd ${HA_SBIN_DIR}/crm_master -l reboot -D
- current_master_score=""
-}
-
source_drbd_shellfuncs()
{
local dir=.
@@ -668,18 +632,11 @@ 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
}
unexpected_primary_rejects_promote()
{
- crm_resource_locate_master
-
: "single master config?"
[[ $OCF_RESKEY_CRM_meta_master_max = 1 ]] || return 1
: "not primary myself?" # because, if I am, I can no longer reject this...
@@ -691,208 +648,6 @@ unexpected_primary_rejects_promote()
return 0
}
-removed_master_score_because_peer_is_primary()
-{
- : "remove master score if peer primary?"; $remove_master_score_if_peer_primary || return 1
- : "primary myself?"; $status_primary && return 1
- : "some peer primary?"; $status_some_peer_primary || return 1
-
- if : "SOME peer ALL up-to-date?"; $status_some_peer_all_up_to_date ; then
- # FIXME this should check if that same primary peer has all healthy
- # disks, not if "some" peer has all healthy disks.
- # But I think this option only makes sense in two node setups,
- # so "some" peer becomes "the" peer anyways.
- : "Okay, peer apparently has healthy disks"
- else
- : "peer is primary, but does not look healthy, use regular master score adjustment"
- return 1
- fi
-
- if : "remove only if unexpected"; $remove_master_score_if_peer_primary_only_if_unexpected; then
- if unexpected_primary_rejects_promote; then
- ## Do not log "err", if this may be intentional (independent clusters),
- ## and this pacemaker was told to not even try to promote
- # case $OCF_RESKEY_CRM_meta_target_role in
- # [Mm]aster|[Ss]tarted|"")
- #
- ## But what if they control it via booth and tickets?
- ## Or other constraints?
-
- # do we even have a master score, currently?
- # logging this with every monitoring interval may be too noisy.
- if get_current_master_score ; then
- ocf_log info "I am connected to a Primary that Pacemaker does not know about! Removing master score."
- remove_master_score
- fi
- return 0
- fi
- : "not unexpected, no special treatment"
- return 1
- fi
-
- : "connected to (apparently healthy) Primary peer, do not allow promote"
- remove_master_score
- return 0
-}
-
-drbd_update_master_score() {
- set -- $OCF_RESKEY_adjust_master_score
- local only_consistent=$1 only_remote=$2 local_ok=$3 as_good_as_it_gets=$4
-
- # 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.
- #
- # TODO: separately configure the master score for diskless clients
- # For now: if it is "intentionally" diskless, and has access to
- # remote UpToDate, consider it slighly worse than "local_ok".
- #
- if : "have quorum?"; $status_have_quorum ; then
- : "quorate, evaluate status in more detail below"
- else
- : "NOT quorate, should not be master."
- remove_master_score
- return
- fi
-
- # I'd like to remove the master score, if we find ourselves be
- # connected to an "unexpected" primary:
- # # unexpected_primary_rejects_promote && remove_master_score
- #
- # BUT.
- # Given bad timing, DRBD may still think it is connected
- # but pacemaker already knows the peer is dead.
- # If now a "monitor" squeezes in between "peer known dead"
- # and the soon to be expected "promote", while DRBD still thinks it was
- # connected to a Primary (likely optimistically waiting for generously
- # configured internal timeouts), if we remove the master score from
- # this monitor action, we delay the failover for up to
- # time-for-DRBD-internals-to-declare-peer-dead
- # plus one extra monitor interval.
- #
- # So at least don't do that by default, check for
- # remove_master_score_if_peer_primary and
- # remove_master_score_if_peer_primary_only_if_unexpected
- #
- if removed_master_score_because_peer_is_primary ; then
- return
- fi
-
- if : "diskless client?"; $status_diskless_client ; then
- if : "primary and access to good data?" ;
- $status_primary && $status_some_peer_all_up_to_date; then
-
- set_master_score $(( as_good_as_it_gets -1 ))
- elif : "ALL peer-disks up-to-date?"; $status_pdsk_all_up_to_date; then
- set_master_score $(( as_good_as_it_gets -1 ))
- elif : "SOME peer-disks up-to-date?"; $status_some_peer_all_up_to_date ; then
- set_master_score $(( local_ok - 1 ))
- else : "Diskless client, without access to good data :("
- remove_master_score
- fi
-
- elif : "all disks up-to-date?"; $status_disk_all_up_to_date ; then
-
- if : "primary?" ; $status_primary ; then
-
- # I am Primary, all local disks are UpToDate
- set_master_score $as_good_as_it_gets
-
- if : "all peer-disks up-to-date?"; $status_pdsk_all_up_to_date; then
- # I am Primary, all local disks are UpToDate,
- # AND all peer disks are UpToDate
- : == DEBUG == unfence_if_all_uptodate=$unfence_if_all_uptodate
- $unfence_if_all_uptodate && call_unfence
-
- # else: not so sure about the peer's disks
- fi
- else : "Not primary."
- if : "any peer-disk unknown?"; $status_pdsk_any_unknown ; then
- # all local disks are UpToDate,
- # but I'm not Primary,
- # and I'm not sure about some 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 $local_ok
- else : "all peer disk states known."
- # 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 $as_good_as_it_gets
- fi
- fi
-
- elif : "some peer with all peer-disks up-to-date?" ; $status_some_peer_all_up_to_date ; then
-
- # At least one of our local disks is not up to date.
- # But at least one of our peers is ALL OK.
- # We can expect to have access to useful
- # data, but with possibly degraded performance,
- # (some) reads need to fetch from the peer.
- set_master_score $only_remote
-
- elif : "in transitional state?"; $status_disk_transitional_state ; then
- # some transitional state.
- # just don't do anything
- : "ignore"
-
- elif : "all disks consistent?" ; $status_disk_all_consistent ; then
- # 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 $only_consistent
-
- else # not $status_disk_all_consistent and not $status_disk_transitional_state
-
- # 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
- fi
-}
-
is_drbd_enabled() {
test -f /proc/drbd
}
@@ -939,6 +694,139 @@ drbd_status() {
return $rc
}
+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)
+ 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
+ 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)
+ 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
+}
+
# I'm sorry, but there is no $OCF_DEGRADED_MASTER or similar yet.
drbd_monitor() {
local status
@@ -954,7 +842,8 @@ drbd_monitor() {
# ---
: "do nothing" ;
else
- drbd_update_master_score
+ drbd_condition $status
+ status=$?
fi
case $status in
@@ -976,17 +865,6 @@ drbd_monitor() {
return $status
}
-called_crm_resource_locate=false
-crm_resource_locate_master()
-{
- $called_crm_resource_locate && return
- called_crm_resource_locate=true
- DRBD_PRIMARY_PEER_according_to_pcmk=$(
- crm_resource --resource "$OCF_RESOURCE_INSTANCE" --locate 2>/dev/null |
- sed -ne 's/^.*is running on: \([^ ]*\) Master.*$/\1/p' |
- grep -vix -m1 -e "$HOSTNAME")
-}
-
figure_out_drbd_peer_uname()
{
# depending on whether or not the peer is currently
@@ -1002,7 +880,6 @@ figure_out_drbd_peer_uname()
$OCF_RESKEY_CRM_meta_notify_demote_uname |
grep -vix -m1 -e "$HOSTNAME" )
DRBD_TO_PEER=${x:+ --peer $x}
- crm_resource_locate_master
}
my_udevsettle()
@@ -1020,6 +897,7 @@ my_udevsettle()
trap - TERM
return 0
}
+
create_device_udev_settle()
{
local dev
@@ -1129,7 +1007,8 @@ drbd_start()
# this is probably dead code.
# Also, ignore the exit code of adjust, as we are
# "running" already, anyways, right?
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
$connect_only_after_promote && break
do_connect
drbd_set_status_variables
@@ -1166,9 +1045,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
}
@@ -1187,14 +1063,13 @@ drbd_reload() {
# Adjust resource just in case reload was requested manually
# Changes to resource parameters do not require this
do_drbdadm adjust $DRBD_RESOURCE
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
;;
$OCF_NOT_RUNNING)
:
;;
esac
- # Update score as adjust_master_score may be changed
- drbd_update_master_score
return $rc
}
@@ -1217,7 +1092,6 @@ drbd_promote() {
if ! $first_try && unexpected_primary_rejects_promote ; then
if $fail_promote_early_if_peer_primary ; then
drbd_ocf_exit_reason "Peer node already/still Primary"
- remove_master_score
break
else
ocf_log info "Peer node already/still Primary, promote will likely fail or need several attempts. Retrying anyways."
@@ -1239,7 +1113,8 @@ drbd_promote() {
break
;;
$OCF_RUNNING_MASTER)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
if $connect_only_after_promote; then
figure_out_drbd_peer_uname
do_drbdadm $DRBD_TO_PEER -v adjust $DRBD_RESOURCE
@@ -1274,7 +1149,8 @@ drbd_demote() {
status=$?
case "$status" in
$OCF_SUCCESS)
- rc=$OCF_SUCCESS
+ drbd_condition $OCF_SUCCESS
+ rc=$?
break
;;
$OCF_NOT_RUNNING)
@@ -1316,7 +1192,21 @@ drbd_stop() {
;;
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
- do_drbdadm secondary $DRBD_RESOURCE
+ found=no
+ for dev in ${DRBD_DEVICES[@]} ""; do
+ cat /proc/mounts | grep -q "^${dev} "
+ if [ $? -eq 0 ]; then
+ ocf_log warn "${DRBD_RESOURCE} is still mounted via $dev"
+ found=yes
+ break
+ fi
+ done
+ if [ "${found}" = "yes" ]; then
+ ocf_log warn "Waiting to drop $DRBD_RESOURCE"
+ else
+ ocf_log warn "Dropping $DRBD_RESOURCE to Secondary"
+ do_drbdadm secondary $DRBD_RESOURCE
+ fi
esac
$first_try || sleep 1
first_try=false
@@ -1326,14 +1216,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
@@ -1370,7 +1255,6 @@ drbd_notify() {
# After something has been done is a good time to
# recheck our status:
drbd_set_status_variables
- drbd_update_master_score
if : "any unknown peer device?"; $status_pdsk_any_unknown ; then
# Still not properly communicating.
@@ -1402,27 +1286,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!"
-
- PCMK_OCF_DEGRADED=$OCF_SUCCESS
- PCMK_OCF_DEGRADED_MASTER=$OCF_RUNNING_MASTER
-
- ## pacemaker since crm_feature_set 3.0.10 knows about "degraded" states.
- ## But it does not work yet, because LRMD filters the exit codes...
- # if (( a > 3 )) || (( a == 3 && b > 0 )) || (( a == 3 && b == 0 && c >= 10 )); then
- # PCMK_OCF_DEGRADED=190
- # PCMK_OCF_DEGRADED_MASTER=191
- # fi
-}
-
require_drbd_module_version()
{
local v k op version_code
@@ -1489,7 +1352,6 @@ _drbd_validate_all () {
DRBD_HAS_EVENTS2=true
DRBD_IS_v9=true
fi
- check_crm_feature_set
if [[ $__OCF_ACTION != stop ]] ; then
meta_expect clone-node-max = 1 || return
@@ -1573,7 +1435,6 @@ _drbd_validate_all () {
# hm. probably misconfigured constraint somewhere.
# sorry. don't retry anywhere.
drbd_ocf_exit_reason "%s" "DRBD resource ${DRBD_RESOURCE} not found in configuration file ${OCF_RESKEY_drbdconf}."
- remove_master_score
: "$OCF_ERR_INSTALLED = OCF_ERR_INSTALLED"
return $OCF_ERR_INSTALLED
fi
@@ -1611,16 +1472,6 @@ _drbd_validate_all () {
fi
esac
- local i j n=0 fallback=false
- for i in $OCF_RESKEY_adjust_master_score; do
- [[ $i = *[!0-9]* ]] && fallback=true && ocf_log err "BAD adjust_master_score value $i ; falling back to default"
- [[ $j && $i -lt $j ]] && fallback=true && ocf_log err "BAD adjust_master_score value $j > $i ; falling back to default"
- j=$i
- n=$(( n+1 ))
- done
- [[ $n != 4 ]] && fallback=true && ocf_log err "Not enough adjust_master_score values ($n != 4); falling back to default"
- $fallback && OCF_RESKEY_adjust_master_score=$OCF_RESKEY_adjust_master_score_default
-
# we use it in various places,
# just make sure it contains what we expect.
HOSTNAME=`uname -n`

View File

@ -1,387 +0,0 @@
---
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

@ -1,16 +1,7 @@
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
diff --git a/user/v84/drbdadm_usage_cnt.c b/user/v84/drbdadm_usage_cnt.c
index 53bc9bc..0bd2ff3 100644
--- a/user/v84/drbdadm_usage_cnt.c
+++ b/user/v84/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)
@ -21,7 +12,7 @@ index ff6d5c8..c6cb4ad 100644
- /* get the kernel module version from /proc/drbd */
- vcs_get_current();
-
- /* get the userland version from REL_VERSION */
- /* get the userland version from PACKAGE_VERSION */
- vcs_get_userland();
-
- cmp = vcs_ver_cmp(&userland_version, &current_vcs_rel);
@ -46,10 +37,7 @@ index ff6d5c8..c6cb4ad 100644
- userland_version.version.minor,
- userland_version.version.sublvl,
- msg);
+ return;
+ return;
}
void add_lib_drbd_to_path(void)
--
1.8.3.1

View File

@ -1,132 +0,0 @@
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,12 @@
diff --git a/scripts/global_common.conf b/scripts/global_common.conf
index a916b70..9797275 100644
--- a/scripts/global_common.conf
+++ b/scripts/global_common.conf
@@ -13,6 +13,7 @@ global {
# minor-count dialog-refresh disable-ip-verification
# cmd-timeout-short 5; cmd-timeout-medium 121; cmd-timeout-long 600;
+ cmd-timeout-short 15;
}
common {

View File

@ -1,34 +0,0 @@
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,25 @@
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index fc2e597..911ae7b 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -102,6 +102,7 @@ endif
$(LN_S) -f notify.sh notify-emergency-reboot.sh ;\
$(LN_S) -f notify.sh notify-emergency-shutdown.sh ;\
$(LN_S) -f notify.sh notify-out-of-sync.sh; )
+ install -m 755 drbd-overview.pl $(DESTDIR)$(sbindir)/drbd-overview
ifeq ($(DISTRO),debian)
@ echo "Don't forget to run update-rc.d"
else
diff --git a/scripts/drbd-overview.pl b/scripts/drbd-overview.pl
index 3d2a397..22abdf4 100755
--- a/scripts/drbd-overview.pl
+++ b/scripts/drbd-overview.pl
@@ -413,8 +413,6 @@ eval {
warn "unrecognized value for --color" unless $use_colors =~ /^[01]$/;
};
-print STDERR "NOTE: drbd-overview will be deprecated soon.\nPlease consider using drbdtop.\n\n";
-
open STDERR, "/dev/null"
if $stderr_to_dev_null;

View File

@ -1,40 +0,0 @@
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

@ -1,25 +0,0 @@
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

View File

@ -1,45 +0,0 @@
From 017157d21a56410811384a43d0b0cbba6444baeb Mon Sep 17 00:00:00 2001
From: Don Penney <don.penney@windriver.com>
Date: Wed, 6 Feb 2019 01:19:59 -0500
Subject: [PATCH] Check for mounted device before demoting Primary DRBD
resource
Update the OCF script to check for a mounted device when demoting
a resource that's in the Primary state. The state change will fail
if it is still in use, otherwise.
Signed-off-by: Don Penney <don.penney@windriver.com>
---
scripts/drbd.ocf | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/scripts/drbd.ocf b/scripts/drbd.ocf
index e03bf6d..95da11a 100644
--- a/scripts/drbd.ocf
+++ b/scripts/drbd.ocf
@@ -720,7 +720,21 @@ drbd_stop() {
;;
$OCF_RUNNING_MASTER)
ocf_log warn "$DRBD_RESOURCE still Primary, demoting."
- do_drbdadm secondary $DRBD_RESOURCE
+ found=no
+ for dev in ${DRBD_DEVICES[@]} ""; do
+ cat /proc/mounts | grep -q "^${dev} "
+ if [ $? -eq 0 ]; then
+ ocf_log warn "${DRBD_RESOURCE} is still mounted via $dev"
+ found=yes
+ break
+ fi
+ done
+ if [ "${found}" = "yes" ]; then
+ ocf_log warn "Waiting to drop $DRBD_RESOURCE"
+ else
+ ocf_log warn "Dropping $DRBD_RESOURCE to Secondary"
+ do_drbdadm secondary $DRBD_RESOURCE
+ fi
esac
$first_try || sleep 1
first_try=false
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From 393137563853cde5561845aeb8498d831d6368aa Mon Sep 17 00:00:00 2001
From: paul <paul@starlingx.com>
Date: Mon, 29 Jun 2020 16:48:39 +0000
Subject: [PATCH] backport: drbd main ipv6: Fix interface indices larger than
255
fscanf line probably copied from kernel printf, but printf specifies the
minimal field width and scanf the maximal field width.
The bug was triggered on Xen servers that create and assign new,
incremented interface IDs for new machines.
ifindex is of type int anyways: struct net_device as defined in
include/linux/netdevice.h. We should not rely on the assumption that
the values are small enough to fit in one byte.
Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
Signed-off-by: paul <paul@starlingx.com>
---
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 19c5a44..d516d6f 100644
--- a/user/drbdadm_main.c
+++ b/user/drbdadm_main.c
@@ -3091,7 +3091,7 @@ int have_ip_ipv6(const char *ip)
while (fscanf
(if_inet6,
- X32(08) X32(08) X32(08) X32(08) " %*02x %*02x %*02x %*02x %s",
+ X32(08) X32(08) X32(08) X32(08) " %*x %*x %*x %*x %s",
b, b + 1, b + 2, b + 3, name) > 0) {
for (i = 0; i < 4; i++)
addr6.s6_addr32[i] = cpu_to_be32(b[i]);
--
1.8.3.1

View File

@ -1,28 +0,0 @@
From 46962e144b850b6a1dca449f0ee623c8e85596d2 Mon Sep 17 00:00:00 2001
From: David Sullivan <david.sullivan@windriver.com>
Date: Tue, 20 Apr 2021 13:22:19 -0500
Subject: [PATCH] Unmount all targets during drbd stop
When stopping drbd, we need to unmount targets from each device. Devices
with multiple mountpoints can fail to unmount, leading to metadata
corruption. Add --all-targets to the umount command.
---
scripts/drbd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/drbd b/scripts/drbd
index 3c7f8a5..eca4e3b 100755
--- a/scripts/drbd
+++ b/scripts/drbd
@@ -182,7 +182,7 @@ case "$1" in
for d in /dev/drbd* ; do
[ -L "$d" ] && continue
[ -b "$d" ] || continue
- M=$(umount "$d" 2>&1)
+ M=$(umount --all-targets "$d" 2>&1)
case $M in
*" not mounted") :;;
*) echo "$M" >&2 ;;
--
2.24.1

View File

@ -1,29 +0,0 @@
From 536eac16f1b6636ce4153fa58c74c417c4f69753 Mon Sep 17 00:00:00 2001
From: Roland Kammerer <roland.kammerer@linbit.com>
Date: Fri, 12 Jul 2019 13:36:50 +0200
Subject: [PATCH] netlink: prepare for kernel v5.2
[mvb: Adapted to drbd-utils 8.4.3.]
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
user/libgenl.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/user/libgenl.h b/user/libgenl.h
index a37493a6e528..b1c3eab345ec 100644
--- a/user/libgenl.h
+++ b/user/libgenl.h
@@ -23,6 +23,10 @@
#define SOL_NETLINK 270
#endif
+#ifndef NLA_F_NESTED
+#define NLA_F_NESTED 0
+#endif
+
#define DEBUG_LEVEL 1
#define dbg(lvl, fmt, arg...) \
--
2.29.2

View File

@ -1,49 +0,0 @@
From 062ec873e733d278c9024be3783f59c532333b75 Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Fri, 12 Jul 2019 15:07:27 +0800
Subject: [PATCH] netlink: Add NLA_F_NESTED flag to nested attribute
The mainline kernel v5.2 commit b424e432e770
("netlink: add validation of NLA_F_NESTED flag") imposes strict validation
against nested attribute as follow.
"
Add new validation flag NL_VALIDATE_NESTED which adds three consistency
checks of NLA_F_NESTED_FLAG:
- the flag is set on attributes with NLA_NESTED{,_ARRAY} policy
- the flag is not set on attributes with other policies except NLA_UNSPEC
- the flag is set on attribute passed to nla_parse_nested()
"
Sending messages with nested attribute without NLA_F_NESTED would cause failed
validation. For example,
$ drbdsetup new-resource r0
Invalid argument
This patch adds NLA_F_NESTED flag to all nested attributes.
Signed-off-by: He Zhe <zhe.he@windriver.com>
[mvb: Adapted to drbd-utils 8.4.3.]
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
user/libgenl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/user/libgenl.h b/user/libgenl.h
index b1c3eab345ec..3b1146109772 100644
--- a/user/libgenl.h
+++ b/user/libgenl.h
@@ -851,7 +851,7 @@ static inline struct nlattr *nla_nest_start(struct msg_buff *msg, int attrtype)
{
struct nlattr *start = (struct nlattr *)msg->tail;
- if (nla_put(msg, attrtype, 0, NULL) < 0)
+ if (nla_put(msg, attrtype | NLA_F_NESTED, 0, NULL) < 0)
return NULL;
return start;
--
2.29.2