Whamcloud - gitweb
LU-9761 dkms: Add ldiskfs dkms support 90/27990/10
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Fri, 5 Aug 2016 15:22:21 +0000 (11:22 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Mar 2018 04:28:15 +0000 (04:28 +0000)
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 <nathaniel.l.clark@intel.com>
Change-Id: Iba500d9830a8f57662066141a176c381151861f4
Reviewed-on: https://review.whamcloud.com/27990
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
autoMakefile.am
contrib/lbuild/lbuild
lustre-dkms.spec.in
lustre-dkms_pre-build.sh
lustre/scripts/dkms.mkconf
lustre/tests/Makefile.am
lustre/tests/mpi/Makefile.am

index dabded8..b5f7c22 100644 (file)
@@ -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) \
index e83b50d..7f94752 100755 (executable)
@@ -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
 }
index 7b0c115..16d229e 100644 (file)
@@ -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[#]=<pkg>"), 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 <nathaniel.l.clark@intel.com>
+- Add option to build either ldiskfs or zfs flavour of server version
 * Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
  - detect and handle cases where [spl,zfs]-dkms packages are not built
  - also handle on-target configure issues
index 2d7d381..f1688fa 100755 (executable)
@@ -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"
index 8ceeb33..e2fc392 100755 (executable)
@@ -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} <<EOF
 BUILD_DEPENDS[0]="zfs"
 EOF
@@ -103,7 +103,7 @@ BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/ptlrpc/gss/"
 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
 fi
 EOF
-if [ $pkgname = "lustre" ] ; then
+if [ $pkgname != "lustre-client" ] ; then
        cat >>${filename} <<EOF
 # Server Modules
 BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="ofd"
@@ -115,9 +115,6 @@ DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
 BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="lfsck"
 BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/lfsck/"
 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
-BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="osd_zfs"
-BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/osd-zfs/"
-DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
 BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="mgs"
 BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/mgs/"
 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
@@ -141,3 +138,19 @@ BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/lod/"
 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
 EOF
 fi
+if [ $pkgname = "lustre-zfs" -o $pkgname = "lustre-all" ] ; then
+       cat >>${filename} <<EOF
+# Module for ZFS backing
+BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="osd_zfs"
+BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/osd-zfs/"
+DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
+EOF
+fi
+if [ $pkgname = "lustre-ldiskfs" -o $pkgname = "lustre-all" ] ; then
+       cat >>${filename} <<EOF
+# Module for ldiskfs backing
+BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="osd_ldiskfs"
+BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/osd-ldiskfs/"
+DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/${kmoddir}/lustre/"
+EOF
+fi
index e32e353..c77958c 100644 (file)
@@ -2,8 +2,6 @@
 AM_CFLAGS := -fPIC -D_GNU_SOURCE \
             -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64
 
-LIBLUSTREAPI = $(top_builddir)/lustre/utils/liblustreapi.la
-
 DIST_SUBDIRS = mpi
 
 noinst_DATA = disk1_8_up_2_5-ldiskfs.tar.bz2 disk2_1_up_2_5-ldiskfs.tar.bz2
@@ -90,9 +88,8 @@ test_PROGRAMS = $(THETESTS)
 nobase_test_SCRIPTS = $(nobase_noinst_SCRIPTS)
 test_DATA = $(noinst_DATA)
 nobase_test_DATA = $(nobase_noinst_DATA)
-else # !TESTS
-noinst_PROGRAMS = $(THETESTS)
-endif # TESTS
+
+LIBLUSTREAPI = $(top_builddir)/lustre/utils/liblustreapi.la
 
 mmap_sanity_LDADD = $(LIBLUSTREAPI)
 multiop_LDADD = $(LIBLUSTREAPI) $(PTHREAD_LIBS)
@@ -109,3 +106,4 @@ lockahead_test_LDADD = $(LIBLUSTREAPI)
 mirror_io_LDADD = $(LIBLUSTREAPI)
 ll_dirstripe_verify_LDADD = $(LIBLUSTREAPI)
 flocks_test_LDADD = $(LIBLUSTREAPI) $(PTHREAD_LIBS)
+endif # TESTS
index a04dcb6..7beb45e 100644 (file)
@@ -13,8 +13,6 @@ test_PROGRAMS = $(THETESTS)
 else
 noinst_PROGRAMS = $(THETESTS)
 endif
-else
-noinst_PROGRAMS = $(THETESTS)
 endif
 
 write_append_truncate_SOURCES=write_append_truncate.c