From 4e7622074296872f63235bdc7790bcb2d1f9b7db Mon Sep 17 00:00:00 2001 From: Shaun Tancheff Date: Wed, 24 Aug 2022 21:22:58 +0700 Subject: [PATCH] LU-16059 build: Installation of dkms server builds 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 Change-Id: Ic154ca045427bf26cb7e6a44b8c467675e987aad Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48083 Reviewed-by: Petros Koutoupis Reviewed-by: Jian Yu Reviewed-by: Minh Diep Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- config/lustre-build-zfs.m4 | 6 ++++-- lustre-dkms.spec.in | 6 ++++-- lustre-dkms_post-build.sh | 13 +++++++++++++ lustre-dkms_pre-build.sh | 12 +++++++----- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/config/lustre-build-zfs.m4 b/config/lustre-build-zfs.m4 index f17f296..8ed44a1 100644 --- a/config/lustre-build-zfs.m4 +++ b/config/lustre-build-zfs.m4 @@ -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}" diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 19ef9c6..755a3b5 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -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 diff --git a/lustre-dkms_post-build.sh b/lustre-dkms_post-build.sh index 6ed20c7..70c8302 100755 --- a/lustre-dkms_post-build.sh +++ b/lustre-dkms_post-build.sh @@ -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 diff --git a/lustre-dkms_pre-build.sh b/lustre-dkms_pre-build.sh index eea05e2..11a1cb0 100755 --- a/lustre-dkms_pre-build.sh +++ b/lustre-dkms_pre-build.sh @@ -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" ;; -- 1.8.3.1