Building DRBD9

From AN!Wiki
Jump to: navigation, search

 AN!Wiki :: How To :: Building DRBD9

Template warning icon.png
Warning: Please note! This is a work in progress and very well may contain mistakes. Do not follow this and push into production without ample testing first!

Building DRBD 9:

This assumes a fresh install.

Contents

On RHEL8

Dependencies

This also handles environment setup.

# Unconfirmed list
dnf install elfutils-libelf-devel gcc git kernel-devel kernel-rpm-macros make perl-interpreter rpm-build tar
 
mkdir ~/git
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cd ~/git
 
git clone https://github.com/LINBIT/drbd-9.0.git
cd drbd-9.0
gmake tarball kmp-rpm srpm

git

Build

Others / Older

On EL7

yum -y groupinstall compat-libraries development security-tools 
yum -y install mlocate vim createrepo wget kabi-yum-plugins docbook-style-xsl docbook-simple docbook-slides docbook-style-dsssl docbook-utils docbook-utils-pdf pygobject2
 
# Repeat for any user building packages
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
mkdir -p ~/rpmbuild/RPMS/{noarch,x86_64}
mkdir ~/git

On CentOS

You can install 'help2man' directly.

yum install help2man

On RHEL

Template note icon.png
Note: This may be in a repo, but I've not found it yet.

You need to build 'help2man' and install manually (get the srpm from CentOS).

On Fedora28

Template note icon.png
Note: This is until EL8 is available. Fedora should never be used as a production server. Ever.
dnf groupinstall 
dnf install 
 
mkdir ~/git

kmod

  • First pull;
cd ~/git
git clone https://github.com/LINBIT/drbd-9.0.git
cd drbd-9.0
gmake tarball kmp-rpm srpm

OR

  • Update existing git repo;
cd ~/git/drbd-9.0
git pull
gmake tarball kmp-rpm srpm

Rebuilding the kmod RPMS

Template note icon.png
Note: The source tarball as the %{release} tag. We've removed that, so the source tarball needs to be extracted, the extracted directory have the release suffix removed, the recompressed to a new tarball, with the name also having the release suffix removed.
rpm -Uvh ~/rpmbuild/SRPMS/drbd-kernel-9.*.src.rpm

Make the following changes to the spec;

--- drbd-kernel.git.spec	2018-02-03 19:45:14.101696758 +0000
+++ drbd-kernel.spec	2018-02-04 04:53:08.615444009 +0000
@@ -4 +4 @@
-Release: 1%{?dist}
+Release: 2%{?dist}
@@ -9 +9 @@
-%global tarball_version %(echo "%{version}-%{?release}" | sed -e "s,%{?dist}$,,")
+%global tarball_version %(echo "%{version}" | sed -e "s,%{?dist}$,,")
@@ -12,6 +12 @@
-Group: System Environment/Kernel
-URL: http://www.drbd.org/
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-%if ! %{defined suse_version}
-BuildRequires: redhat-rpm-config
-%endif
+URL: http://www.drbd.org
@@ -26,0 +22,2 @@
+Rebuilt for the Anvil! Intelligent Availability platform.
+
@@ -30,12 +26,0 @@
-%if %{defined suse_kernel_module_package}
-# Support also sles10, where kernel_module_package was not yet defined.
-# In sles11, suse_k_m_p became a wrapper around k_m_p.
-
-%if 0%{?suse_version} < 1110
-# We need to exclude some flavours on sles10 etc,
-# or we hit an rpm internal buffer limit.
-%suse_kernel_module_package -n drbd -f filelist-suse kdump kdumppae vmi vmipae um
-%else
-%suse_kernel_module_package -n drbd -f filelist-suse
-%endif
-%else
@@ -51 +36,3 @@
-%define _this_kmp_version %{version}_%(echo %kernel_version | sed -r 'y/-/_/; s/\.el.\.(x86_64|i.86)$//;')
+%define kernel_version %(uname -r | sed -r 'y/-/_/;' | sed -r 'y/-/_/; s/\.el.\.(x86_64|i.86)$//;)
+%define kdir /usr/src/kernels/%(uname -r)
+%define _this_kmp_version %{version}_%{kernel_version}
@@ -53 +40,2 @@
-%endif
+%files
+/etc/depmod.d/drbd.conf
@@ -63 +51 @@
-    make -C obj/$flavor %{_smp_mflags} all KDIR=%{kernel_source $flavor}
+    make -C obj/$flavor %{_smp_mflags} all KDIR=%{kdir $flavor}
@@ -72,3 +59,0 @@
-%if %{defined suse_kernel_module_package}
-export INSTALL_MOD_DIR=updates
-%else
@@ -77 +61,0 @@
-%endif
@@ -91,6 +74,0 @@
-%if %{defined suse_kernel_module_package}
-# On SUSE, putting the modules into the default path determined by
-# %kernel_module_package_moddir is enough to give them priority over
-# shipped modules.
-rm -f drbd.conf
-%else
@@ -100 +77,0 @@
-%endif
@@ -105,0 +83,3 @@
+* Fri Feb 02 2018 Madison Kelly <mkelly@alteeve.ca> - 9.0.12-2
+- First build for the Anvil! m3 platform.

Then build.

rpmbuild -ba drbd-kernel.spec

utils

  • First pull;
cd ~/git
git clone https://github.com/LINBIT/drbd-utils.git
cd drbd-utils/
./autogen.sh
./configure --without-83support --without-84support --with-pacemaker --with-bashcompletion --without-xen --without-heartbeat --without-rgmanager 
gmake clean all
gmake tarball rpm srpm

OR

  • Update existing git repo;
cd ~/git/drbd-utils/
git pull
./autogen.sh
./configure --without-83support --without-84support --with-pacemaker --with-bashcompletion
gmake clean all
gmake tarball rpm srpm

Rebuilding the drbd-utils RPMs

rpm -Uvh ~/rpmbuild/SRPMS/drbd-9.*.src.rpm
Template note icon.png
Note: We've fairly heavily modified the .spec.

Make these changes:

--- drbd.git.spec	2018-02-03 18:40:42.087148052 +0000
+++ drbd.spec	2018-02-04 05:08:08.045662886 +0000
@@ -13,10 +12,0 @@
-%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
-
@@ -26,5 +15,0 @@
-%bcond_without manual
-%bcond_without udev
-%bcond_without pacemaker
-%bcond_with rgmanager
-%bcond_without heartbeat
@@ -32,5 +16,0 @@
-%bcond_without bashcompletion
-%bcond_without sbinsymlinks
-# --with xen is ignored on any non-x86 architecture
-%bcond_without xen
-%bcond_without 83support
@@ -38,4 +17,0 @@
-%bcond_without drbdmon
-%ifnarch %{ix86} x86_64
-%global _without_xen --without-xen
-%endif
@@ -50 +25,0 @@
-Group: System Environment/Kernel
@@ -52 +26,0 @@
-BuildRoot: %(mktemp -ud %{_tmppath}/drbd-utils-%{version}-%{release}-XXXXXX)
@@ -55,6 +28,0 @@
-%ifarch %{ix86} x86_64
-%if %{with xen}
-Requires: drbd-xen = %{version}
-%endif
-%endif
-%if %{with udev}
@@ -63,2 +30,0 @@
-%endif
-%if %{with pacemaker}
@@ -66,2 +31,0 @@
-%endif
-%if %{with drbdmon}
@@ -69,16 +32,0 @@
-%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: 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 bashcompletion}
@@ -86 +33,0 @@
-%endif
@@ -94,0 +42,2 @@
+Rebuilt for the Anvil! Intelligent Availability platform.
+
@@ -105 +53,0 @@
-Group: System Environment/Kernel
@@ -122,4 +69,0 @@
-%if %{with 83support}
-# which 8.3 version equivalent this package provides
-Provides: drbd-utils = 8.3.16
-%endif
@@ -132,4 +75,0 @@
-%if %{initscripttype} == "sysv"
-Requires(post): chkconfig
-Requires(preun): chkconfig
-%endif
@@ -143,0 +84,2 @@
+Rebuilt for the Anvil! Intelligent Availability platform.
+
@@ -146,5 +87,0 @@
-%if %{with sbinsymlinks}
-/sbin/drbdsetup
-/sbin/drbdadm
-/sbin/drbdmeta
-%endif
@@ -154,5 +90,0 @@
-%if %{with 83support}
-%dir /lib/drbd/
-/lib/drbd/drbdsetup-83
-/lib/drbd/drbdadm-83
-%endif
@@ -163 +94,0 @@
-%if %{with drbdmon}
@@ -165,4 +95,0 @@
-%endif
-%if %{initscripttype} == "sysv"
-%{_initddir}/drbd
-%endif
@@ -187 +113,0 @@
-%if %{initscripttype} == "systemd"
@@ -191 +116,0 @@
-%endif
@@ -195,2 +119,0 @@
-%if %{without manual}
-%else
@@ -202 +124,0 @@
-%if %{with drbdmon}
@@ -204,2 +125,0 @@
-%endif
-%endif
@@ -211,12 +130,0 @@
-%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}
-
-
-
-%description xen
-This package contains a Xen block device helper script for DRBD, capable of
-promoting and demoting DRBD resources as necessary.
@@ -224,7 +131,0 @@
-%files xen
-%defattr(755,root,root,-)
-%{_sysconfdir}/xen/scripts/block-drbd
-%endif # with xen
-%endif # arch %{ix86} x86_64
-
-%if %{with udev}
@@ -233 +133,0 @@
-Group: System Environment/Kernel
@@ -240,0 +141,2 @@
+Rebuilt for the Anvil! Intelligent Availability platform.
+
@@ -244 +145,0 @@
-%endif # with udev
@@ -246 +146,0 @@
-%if %{with pacemaker}
@@ -249 +148,0 @@
-Group: System Environment/Base
@@ -258,0 +158,2 @@
+Built for the Anvil! Intelligent Availability platform.
+
@@ -268,45 +168,0 @@
-%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: drbd-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/drbd/rhcs_fence
-
-%defattr(-,root,root,-)
-%{_datadir}/cluster/drbd.metadata
-%endif # with rgmanager
@@ -314,26 +169,0 @@
-%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,-)
-%if %{without manual}
-%else
-%{_mandir}/man8/drbddisk-*
-%endif
-%endif # with heartbeat
-
-%if %{with bashcompletion}
@@ -342 +171,0 @@
-Group: System Environment/Base
@@ -350,0 +180,2 @@
+Built for the Anvil! Intelligent Availability platform.
+
@@ -354 +184,0 @@
-%endif # with bashcompletion
@@ -356,2 +185,0 @@
-%if %{without manual}
-%else
@@ -360 +187,0 @@
-Group: System Environment/Base
@@ -365,0 +193,2 @@
+Built for the Anvil! Intelligent Availability platform.
+
@@ -373,3 +201,0 @@
-%if %{with heartbeat}
-%{_mandir}/ja/man8/drbddisk-*
-%endif
@@ -395 +220,0 @@
-%endif # without manual
@@ -406,7 +231,7 @@
-    %{?_without_udev} \
-    %{?_without_xen} \
-    %{?_without_pacemaker} \
-    %{?_without_heartbeat} \
-    %{?_with_rgmanager} \
-    %{?_without_bashcompletion} \
-    %{?_without_83support} \
+    --without-xen \
+    --without-heartbeat \
+    --without-rgmanager \
+    --without-83support \
+    --with-udev \
+    --with-pacemaker \
+    --with-bashcompletion \
@@ -414 +239 @@
-    %{?_without_manual} \
+    --with-manual \
@@ -417,2 +242,2 @@
-    --with-initscripttype=%{initscripttype} \
-    %{?_without_drbdmon}
+    --with-initscripttype=systemd \
+    --with-drbdmon
@@ -422 +246,0 @@
-rm -rf %{buildroot}
@@ -425,13 +248,0 @@
-%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
-
@@ -442 +252,0 @@
-%if %{initscripttype} == "systemd"
@@ -444,6 +253,0 @@
-%endif
-%if %{initscripttype} == "sysv"
-chkconfig --add drbd
-%endif
-%if %{without manual}
-%else
@@ -454 +257,0 @@
-%if %{with drbdmon}
@@ -456,7 +258,0 @@
-%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;
-done
-%endif #without udev
@@ -470 +265,0 @@
-%if %{initscripttype} == "systemd"
@@ -472,7 +266,0 @@
-%endif
-%if %{initscripttype} == "sysv"
-if [ $1 -eq 0 ]; then
-        %{_initrddir}/drbd stop >/dev/null 2>&1
-        /sbin/chkconfig --del drbd
-fi
-%endif
@@ -480 +267,0 @@
-%if %{initscripttype} == "systemd"
@@ -483 +269,0 @@
-%endif
@@ -487 +273 @@
-* Fri Dec 21 2017 Roland Kammerer <roland.kammerer@linbit.com> - 9.2.0-1
+* Thu Dec 21 2017 Roland Kammerer <roland.kammerer@linbit.com> - 9.2.0-1

Then rebuild.

rpmbuild -ba drbd.spec


Template note icon.png
Note: The git-generated src.rpm must be built with rpmbuild --without sbinsymlinks -ba drbd.spec to avoid the self-conflicting file /usr/sbin/drbdadm conflicts between attempted installs of drbd-utils-8.9.11rc1-1.el7.centos.x86_64 and drbd-utils-8.9.11rc1-1.el7.centos.x86_64 (and two others) errors.

drbdtop

Template todo icon.png
TODO: To be sorted...
  • First pull;
cd ~/git
git clone https://github.com/LINBIT/drbdtop.git
cd drbdtop

OR

  • Update existing git repo;
cd ~/git/drbdtop
git pull

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Us: Alteeve's Niche! Support: Mailing List IRC: #clusterlabs on Freenode   © Alteeve's Niche! Inc. 1997-2019
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.
Personal tools
Namespaces

Variants
Actions
Navigation
projects
Toolbox