Whamcloud - gitweb
LU-16059 build: Installation of dkms server builds 83/48083/7
authorShaun Tancheff <shaun.tancheff@hpe.com>
Wed, 24 Aug 2022 14:22:58 +0000 (21:22 +0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Oct 2022 19:35:46 +0000 (19:35 +0000)
The linux-zfs-dkms package is passing the wrong paths
for zfs [and spl] causing the dkms build to fail.

ZFS_VERSION is not parsed correctly from 'dkms status'.

The splver and zfsver check can match against the wrong
package(s).

lustre-zfs-dkms provides: kmod-lustre-osd-zfs, and
                          lustre-osd-zfs-mount
lustre-ldiskfs-dkms provides: kmod-lustre-osd-ldiskfs and
                              lustre-osd-ldiskfs-mount

In the case of multiple zfs versions installed, build lustre
osd against the highest version number.

HPE-bug-id: LUS-11113
Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Ic154ca045427bf26cb7e6a44b8c467675e987aad
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48083
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
config/lustre-build-zfs.m4
lustre-dkms.spec.in
lustre-dkms_post-build.sh
lustre-dkms_pre-build.sh

index f17f296..8ed44a1 100644 (file)
@@ -71,7 +71,8 @@ AC_DEFUN([LB_SPL], [
        dnl # The existence of spl.release[.in] is used to identify a valid
        dnl # source directory.  In order of preference:
        dnl #
-       splver=$(ls -1 /usr/src/ | grep -m1 spl | cut -f2 -d'-')
+       splver=$(ls -1 /usr/src/ | grep ^spl- | cut -f2 -d'-' |
+                sort -V | head -n1)
        spldkms="/var/lib/dkms/spl/${splver}"
        splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
        splsrc2="/usr/src/spl-${splver}"
@@ -192,7 +193,8 @@ AC_DEFUN([LB_ZFS], [
        dnl # The existence of zfs.release[.in] is used to identify a valid
        dnl # source directory.  In order of preference:
        dnl #
-       zfsver=$(ls -1 /usr/src/ | grep -m1 zfs | cut -f2 -d'-')
+       zfsver=$(ls -1 /usr/src/ | grep ^zfs- | cut -f2 -d'-' |
+                sort -V | head -n1)
        zfsdkms="/var/lib/dkms/zfs/${zfsver}"
        zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
        zfssrc2="/usr/src/zfs-${zfsver}"
index 19ef9c6..755a3b5 100644 (file)
@@ -73,7 +73,6 @@ Requires:     libnl3-devel
 Obsoletes:     @PACKAGE@-client < %{version}
 %if %{with zfs}
 Requires:       zfs-dkms >= 0.6.5
-Requires:      @PACKAGE@-osd-zfs-mount
 Conflicts:     @PACKAGE@-ldiskfs-dkms
 Conflicts:     @PACKAGE@-client-dkms
 # lustre-zfs-dkms replicates the functionality old lustre-dkms package
@@ -83,7 +82,6 @@ Obsoletes:    @PACKAGE@-dkms
 %if %{with ldiskfs}
 Requires:      patch
 Requires:      %{ext4_source_rpm}
-Requires:      @PACKAGE@-osd-ldiskfs-mount
 Conflicts:     @PACKAGE@-zfs-dkms
 Conflicts:     @PACKAGE@-client-dkms
 %if "%{module}" != "@PACKAGE@-all"
@@ -101,9 +99,13 @@ Provides:   @PACKAGE@-modules = %{version}
 %if %{with servers}
 %if %{with zfs}
 Provides:      @PACKAGE@-osd-zfs = %{version}
+Provides:      kmod-@PACKAGE@-osd-zfs = %{version}
+Provides:      @PACKAGE@-osd-zfs-mount = %{version}
 %endif
 %if %{with ldiskfs}
 Provides:      @PACKAGE@-osd-ldiskfs = %{version}
+Provides:      kmod-@PACKAGE@-osd-ldiskfs = %{version}
+Provides:      @PACKAGE@-osd-ldiskfs-mount = %{version}
 %endif
 Provides:      @PACKAGE@-osd
 %else
index 6ed20c7..70c8302 100755 (executable)
@@ -25,3 +25,16 @@ cp -f "$7/$1/$2/build/config.log" "$7/$1/$2/$3/$5/log/config.log" 2>/dev/null
 cp -f "$7/$1/$2/build/config.h" \
     "$7/$1/$2/build/Module.symvers" \
     "$7/$1/$2/$3/$5/" 2> /dev/null
+
+case $1 in
+    lustre-zfs|lustre-all)
+       # To satisfy the content of lustre-osd-zfs-mount install these scripts:
+       for script in statechange-lustre.sh \
+                     vdev_attach-lustre.sh \
+                     vdev_clear-lustre.sh \
+                     vdev_remove-lustre.sh
+       do
+               install -D -m 0755 lustre/scripts/${script} /etc/zfs/zed.d/${script}
+       done
+       ;;
+esac
index eea05e2..11a1cb0 100755 (executable)
@@ -20,7 +20,9 @@ case $1 in
        fi
 
        # ZFS and SPL are version locked
-       ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
+       ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 2>/dev/null |
+                     sed -e 's:zfs/::g' -e 's:,.*::g' | cut -d: -f1 |
+                     sort -V | head -n1)
        if [ -z $ZFS_VERSION ] ; then
                echo "zfs-dkms package must already be installed and built under DKMS control"
                exit 1
@@ -28,10 +30,10 @@ case $1 in
 
        SERVER="--enable-server $LDISKFS \
                --with-linux=$4 --with-linux-obj=$4 \
-               --with-spl=$6/spl-${ZFS_VERSION} \
-               --with-spl-obj=$7/spl/${ZFS_VERSION}/$3/$5 \
-               --with-zfs=$6/zfs-${ZFS_VERSION} \
-               --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
+               --with-spl=$(realpath $7/spl/${ZFS_VERSION}/source) \
+               --with-spl-obj=$(realpath $7/spl/kernel-$3-$5) \
+               --with-zfs=$(realpath $7/zfs/${ZFS_VERSION}/source) \
+               --with-zfs-obj=$(realpath $7/zfs/kernel-$3-$5)"
 
        KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
        ;;