From 64a49a1d42b44dfdbc2f951177be3cbb9cd368f9 Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Fri, 5 Aug 2016 11:22:21 -0400 Subject: [PATCH] LU-9761 dkms: Add ldiskfs dkms support This breaks out lustre-dkms into lustre-zfs-dkms and lustre-ldiskfs-dkms (or lustre-all-dkms) as "flavours" of lustre server dkms. The reason for the flavours is to prevent lustre ldiskfs dkms build from having ZFS dependencies, and to maintain lustre zfs dkms build ordering when rebuilding for new kernels. This also prevents building of tests and utils when --disable-tests and --disable-utils (respectively) are passed to configure. Test-Parameters: trivial Signed-off-by: Nathaniel Clark Change-Id: Iba500d9830a8f57662066141a176c381151861f4 Reviewed-on: https://review.whamcloud.com/27990 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- autoMakefile.am | 65 ++++++++++++++++++++++++++++++----- contrib/lbuild/lbuild | 30 +++++++++++++--- lustre-dkms.spec.in | 81 +++++++++++++++++++++++++++++++++++--------- lustre-dkms_pre-build.sh | 35 ++++++++++++++----- lustre/scripts/dkms.mkconf | 23 ++++++++++--- lustre/tests/Makefile.am | 8 ++--- lustre/tests/mpi/Makefile.am | 2 -- 7 files changed, 193 insertions(+), 51 deletions(-) diff --git a/autoMakefile.am b/autoMakefile.am index dabded8..b5f7c22 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -125,15 +125,55 @@ rpm-local: $(MKDIR_P) $(rpmbuilddir)/SOURCES) if SERVER -DKMS_PACKAGE=$(PACKAGE) -DKMS_SERVER=--with servers +dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile + rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ + $(MAKE) $(AM_MAKEFLAGS) \ + rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + --define "_sourcedir $(top_srcdir)" \ + --with servers --with zfs -without ldiskfs \ + --bs $(PACKAGE)-dkms.spec || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + --define "_sourcedir $(top_srcdir)" \ + --with servers --without zfs --with ldiskfs \ + --bs $(PACKAGE)-dkms.spec || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + --define "_sourcedir $(top_srcdir)" \ + --with servers --with zfs --with ldiskfs \ + --bs $(PACKAGE)-dkms.spec || exit 1; \ + cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \ + rm -rf $$rpmbuilddir + +dkms-rpm: dkms-srpm + rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + @RPMBUILD_BINARY_ARGS@ \ + --with servers --with zfs --without ldiskfs \ + --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + @RPMBUILD_BINARY_ARGS@ \ + --with servers --without zfs --with ldiskfs \ + --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \ + $(RPMBUILD) \ + --define "_tmppath $$rpmbuilddir/TMP" \ + --define "_topdir $$rpmbuilddir" \ + @RPMBUILD_BINARY_ARGS@ \ + --with servers --with zfs --with ldiskfs \ + --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \ + cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \ + rm -rf $$rpmbuilddir else -DKMS_PACKAGE=$(PACKAGE)-client -DKMS_SERVER=--without servers -endif -# Only zfs Lustre DKMS Server is supported, so previous configure command -# must use related parameters for success. dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ $(MAKE) $(AM_MAKEFLAGS) \ @@ -142,7 +182,7 @@ dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile --define "_tmppath $$rpmbuilddir/TMP" \ --define "_topdir $$rpmbuilddir" \ --define "_sourcedir $(top_srcdir)" \ - $(DKMS_SERVER) \ + --without servers \ --bs $(PACKAGE)-dkms.spec || exit 1; \ cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \ rm -rf $$rpmbuilddir @@ -153,10 +193,17 @@ dkms-rpm: dkms-srpm --define "_tmppath $$rpmbuilddir/TMP" \ --define "_topdir $$rpmbuilddir" \ @RPMBUILD_BINARY_ARGS@ \ - --rebuild $(DKMS_PACKAGE)-dkms-*.src.rpm || exit 1; \ + --without servers \ + --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \ cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \ rm -rf $$rpmbuilddir +endif + +dkms-srpms: dkms-srpm + +dkms-rpms: dkms-rpm + rpms: srpm rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \ $(MAKE) $(AM_MAKEFLAGS) \ diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index e83b50d..7f94752 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -951,10 +951,8 @@ build_lustre() { return 0 } -# Only zfs Lustre DKMS Server is supported build_lustre_dkms() { local build_args="" - local name_prefix="lustre" local ver=$(sed -n -e 's/^LUSTRE_VERSION = //p' LUSTRE-VERSION-FILE) echo "Building Lustre DKMS RPMs for: $TARGET_ARCH" @@ -962,14 +960,36 @@ build_lustre_dkms() { if $PATCHLESS; then build_args="--without servers" - name_prefix="lustre-client" fi rpmbuild --define "_topdir $TOPDIR" $build_args -bs lustre-dkms.spec || fatal 1 "Error building DKMS .src.rpm for $TARGET_ARCH." - rpmbuild --define "_topdir $TOPDIR" $build_args \ - --rebuild $TOPDIR/SRPMS/$name_prefix-dkms-$ver-*.src.rpm || + + if $PATCHLESS; then + rpmbuild --define "_topdir $TOPDIR" $build_args \ + --rebuild $TOPDIR/SRPMS/lustre-client-dkms-$ver-*.src.rpm || fatal 1 "Error building DKMS .rpm for $TARGET_ARCH." + else + rpmbuild --define="_topdir $TOPDIR" --with servers \ + --with zfs --without ldiskfs -bs lustre-dkms.spec || + fatal 1 "Error creating DKMS (zfs) .srpm for $TARGET_ARCH." + rpmbuild --define="_topdir $TOPDIR" --with servers \ + --without zfs --with ldiskfs -bs lustre-dkms.spec || + fatal 1 "Error creating DKMS (ldiskfs) .srpm for $TARGET_ARCH." + rpmbuild --define="_topdir $TOPDIR" --with servers \ + --with zfs --with ldiskfs -bs lustre-dkms.spec || + fatal 1 "Error creating DKMS (all) .srpm for $TARGET_ARCH." + + rpmbuild --rebuild --define="_topdir $TOPDIR" --with servers \ + --with zfs --without ldiskfs $TOPDIR/SRPMS/lustre-zfs-dkms-$ver-*.src.rpm || + fatal 1 "Error building DKMS (zfs) .rpm for $TARGET_ARCH." + rpmbuild --rebuild --define="_topdir $TOPDIR" --with servers \ + --without zfs --with ldiskfs $TOPDIR/SRPMS/lustre-ldiskfs-dkms-$ver-*.src.rpm || + fatal 1 "Error building DKMS (ldiskfs) .rpm for $TARGET_ARCH." + rpmbuild --rebuild --define="_topdir $TOPDIR" --with servers \ + --with zfs --with ldiskfs $TOPDIR/SRPMS/lustre-all-dkms-$ver-*.src.rpm || + fatal 1 "Error building DKMS (all) .rpm for $TARGET_ARCH." + fi return 0 } diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 7b0c115..16d229e 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -1,23 +1,44 @@ %bcond_without servers +%bcond_without zfs +%bcond_with ldiskfs # Set the package name prefix %if %{with servers} - %define module @PACKAGE@ + %if %{with zfs} + %if %{with ldiskfs} + %define module @PACKAGE@-all + %else + %define module @PACKAGE@-zfs + %endif + %else + %if %{without ldiskfs} + %define module @PACKAGE@-BADSTATE + %else + %define module @PACKAGE@-ldiskfs + %endif + %endif + %define lustre_name @PACKAGE@ + %else - %define module @PACKAGE@-client + %define module @PACKAGE@-client + %define lustre_name @PACKAGE@-client %endif %if %{_vendor}=="redhat" || %{_vendor}=="fedora" - %global requires_kmod_name kmod-%{module} + %global kmod_name kmod-%{lustre_name} %define mkconf_options %else #for Suse / Ubuntu - %global requires_kmod_name %{module}-kmp + %global kmod_name %{lustre_name}-kmp %define mkconf_options "-k updates" %endif %define buildid 1 %define mkconf lustre/scripts/dkms.mkconf +# There should be a better (non-arch dependent) way to require ext4 +# sources +%define ext4_source_rpm kernel-debuginfo-common-x86_64 + Name: %{module}-dkms Version: @VERSION@ @@ -35,28 +56,57 @@ BuildArch: noarch # (ie, "BUILD_DEPENDS[#]="), and have latest DKMS fixes integrated # for bugs that prevented our module to build/install. Requires: dkms >= 2.2.0.3-28.git.7c3e7c5 +# for lnetctl +Requires: libyaml-devel %if %{with servers} -# Only zfs Lustre DKMS Server is supported -Requires: spl-dkms >= 0.6.1 -Requires: zfs-dkms >= 0.6.1 -Requires: %{module}-osd-zfs-mount # If client package is installed when installing server, remove it since # the server package also includes the client. This can be removed if/when # the packages are split into independent client/server/common packages. Obsoletes: @PACKAGE@-client < %{version} +%if %{with zfs} +Requires: spl-dkms >= 0.6.5 +Requires: zfs-dkms >= 0.6.5 +Requires: @PACKAGE@-osd-zfs-mount +Conflicts: @PACKAGE@-ldiskfs-dkms +Conflicts: @PACKAGE@-client-dkms +Obsoletes: @PACKAGE@-dkms +%endif +%if %{with ldiskfs} +Requires: %{ext4_source_rpm} +Requires: @PACKAGE@-osd-ldiskfs-mount +Conflicts: @PACKAGE@-zfs-dkms +Conflicts: @PACKAGE@-client-dkms +%if "%{module}" != "@PACKAGE@-all" +Conflicts: @PACKAGE@-dkms +%endif +%endif +%if "%{module}" != "@PACKAGE@-all" +Conflicts: @PACKAGE@-all-dkms +%endif %endif Requires: gcc, make, perl Requires: kernel-devel -Provides: %{requires_kmod_name} = %{version} -Provides: %{module}-modules = %{version} +Provides: %{kmod_name} = %{version} +Provides: @PACKAGE@-modules = %{version} %if %{with servers} -# Only zfs Lustre DKMS Server is supported -Provides: %{module}-osd-zfs = %{version} -Provides: %{module}-osd +%if %{with zfs} +Provides: @PACKAGE@-osd-zfs = %{version} +%endif +%if %{with ldiskfs} +Provides: @PACKAGE@-osd-ldiskfs = %{version} +%endif +Provides: @PACKAGE@-osd +%else +Provides: @PACKAGE@-client %endif %description This package contains the dkms Lustre kernel modules. +%if %{with ldiskfs} + +The required %{ext4_source_rpm} package is available from +the repository with other debuginfo rpms. +%endif %prep %setup -q -n @PACKAGE@-%{version} @@ -70,10 +120,7 @@ if [ "$RPM_BUILD_ROOT" != "/" ]; then fi mkdir -p $RPM_BUILD_ROOT/usr/src/ cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/ -%if %{without servers} -# To have the directory reflect the DKMS RPM name! mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version} -%endif %clean if [ "$RPM_BUILD_ROOT" != "/" ]; then @@ -103,6 +150,8 @@ dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade exit 0 %changelog +* Mon Aug 1 2016 Nathaniel Clark +- Add option to build either ldiskfs or zfs flavour of server version * Sat Jan 23 2016 Bruno Faccini - detect and handle cases where [spl,zfs]-dkms packages are not built - also handle on-target configure issues diff --git a/lustre-dkms_pre-build.sh b/lustre-dkms_pre-build.sh index 2d7d381..f1688fa 100755 --- a/lustre-dkms_pre-build.sh +++ b/lustre-dkms_pre-build.sh @@ -7,10 +7,18 @@ # $6 : $source_tree # $7 : $dkms_tree -if [ $1 = "lustre-client" ] ; then +case $1 in + lustre-client) SERVER="--disable-server" KERNEL_STUFF="" -else + ;; + + lustre-zfs|lustre-all) + LDISKFS="" + if [ "$1" == "lustre-zfs" ]; then + LDISKFS="--disable-ldiskfs" + fi + SPL_VERSION=$(dkms status -m spl -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$') if [ -z $SPL_VERSION ] ; then echo "spl-dkms package must already be installed and built under DKMS control" @@ -22,14 +30,23 @@ else exit 1 fi - SERVER="--enable-server --disable-ldiskfs --with-linux=$4 --with-linux-obj=$4 \ - --with-spl=$6/spl-${SPL_VERSION} \ - --with-spl-obj=$7/spl/${SPL_VERSION}/$3/$5 \ - --with-zfs=$6/zfs-${ZFS_VERSION} \ - --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5" + SERVER="--enable-server $LDISKFS \ + --with-linux=$4 --with-linux-obj=$4 \ + --with-spl=$6/spl-${SPL_VERSION} \ + --with-spl-obj=$7/spl/${SPL_VERSION}/$3/$5 \ + --with-zfs=$6/zfs-${ZFS_VERSION} \ + --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5" KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4" -fi + ;; + + lustre-ldiskfs) + SERVER="--enable-server --without-zfs --without-spl \ + --with-linux=$4 --with-linux-obj=$4" + + KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4" + ;; +esac PACKAGE_CONFIG="/etc/sysconfig/lustre" DKMS_CONFIG_OPTS=$( @@ -66,7 +83,7 @@ fi ./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \ --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \ $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \ - --disable-manpages + --disable-manpages --disable-mpitests if [ $? != 0 ] ; then echo "configure error, check $7/$1/$2/build/config.log" diff --git a/lustre/scripts/dkms.mkconf b/lustre/scripts/dkms.mkconf index 8ceeb33..e2fc392 100755 --- a/lustre/scripts/dkms.mkconf +++ b/lustre/scripts/dkms.mkconf @@ -30,7 +30,7 @@ PRE_BUILD="lustre-dkms_pre-build.sh \$module \$module_version \$kernelver \$kern POST_BUILD="lustre-dkms_post-build.sh \$module \$module_version \$kernelver \$kernel_source_dir \ \$arch \$source_tree \$dkms_tree" EOF -if [ $pkgname = "lustre" ] ; then +if [ $pkgname = "lustre-zfs" -o $pkgname = "lustre-all" ] ; then cat >>${filename} <>${filename} <>${filename} <>${filename} <