Whamcloud - gitweb
LU-16059 build: Installation of dkms server builds 12/48212/3
authorShaun Tancheff <shaun.tancheff@hpe.com>
Mon, 19 Sep 2022 16:42:09 +0000 (09:42 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 26 Sep 2022 16:57:28 +0000 (16:57 +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.

Lustre-change: https://review.whamcloud.com/48083
Lustre-commit: c3dc67b2c5bf1974d792b3701d932bd04c756bd8

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/48212
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@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"
        ;;