From: Shaun Tancheff Date: Thu, 3 Apr 2025 07:26:16 +0000 (+0700) Subject: LU-18254 dkms: optional support for weak-modules X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=98af2eaf78fb701e735bb5d828600bc5ccdf745c;p=fs%2Flustre-release.git LU-18254 dkms: optional support for weak-modules Conditionally support weak modules by setting: LUSTRE_DKMS_NO_WEAK_MODULES=no in /etc/sysconfig/dkms-lustre before installing the dkms package. Duplicate the o2ib and kfi detection from lustre-dkms_pre-build.sh into dkms.mkconf and dkms.conf.in for rpm and deb packaging Test-Parameters: trivial clientextra_install_params="--dkms" \ serverextra_install_params="--dkms" testgroup=full-dkms Signed-off-by: Shaun Tancheff Change-Id: I09502ad4a2e4930694725cf00b847ecacc4ca043 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56452 Reviewed-by: James Simmons Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/debian/dkms.conf.in b/debian/dkms.conf.in index 0297cc3..826131d 100644 --- a/debian/dkms.conf.in +++ b/debian/dkms.conf.in @@ -17,20 +17,34 @@ # PACKAGE_NAME="lustre-client-modules" -PACKAGE_CONFIG="/etc/sysconfig/lustre" +PACKAGE_CONFIG="/etc/sysconfig/dkms-lustre" +PACKAGE_CONFIG_FALLBACK="/etc/sysconfig/lustre" PACKAGE_VERSION="@UPVERSION@" +no_weak_modules=yes +strip_default=no OPTS="" if [[ "x${PACKAGE_NAME}" = "xlustre-client-modules" ]] ; then OPTS="${OPTS} --disable-server --disable-quilt" fi +[[ -f /usr/src/kfabric/default/Module.symvers ]] && + OPTS="${OPTS} --with-kfi=/usr/src/kfabric/default" +[[ -d /usr/src/ofa_kernel/default ]] && + OPTS="${OPTS} --with-o2ib=/usr/src/ofa_kernel/default" OPTS="${OPTS} --disable-dependency-tracking --disable-doc" OPTS="${OPTS} --disable-utils --disable-iokit --disable-tests" OPTS="${OPTS} --enable-quota --with-kmp-moddir=updates" +[[ -r ${PACKAGE_CONFIG} ]] || PACKAGE_CONFIG=${PACKAGE_CONFIG_FALLBACK} if [[ -r ${PACKAGE_CONFIG} ]] ; then source ${PACKAGE_CONFIG} shopt -q -s extglob + if [[ -n \${LUSTRE_DKMS_DISABLE_STRIP} ]] ; then + [[ \${LUSTRE_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] && strip_default=no + fi + if [[ -n \${LUSTRE_DKMS_ENABLE_STRIP} ]] ; then + [[ \${LUSTRE_DKMS_ENABLE_STRIP,,} == @(y|yes) ]] && strip_default=yes + fi if [[ -n ${LUSTRE_DKMS_DISABLE_CDEBUG} ]] ; then [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]] && OPTS="${OPTS} --disable-libcfs-cdebug" || @@ -61,6 +75,10 @@ if [[ -r ${PACKAGE_CONFIG} ]] ; then fi [[ -n ${LUSTRE_DKMS_CONFIGURE_EXTRA} ]] && OPTS="${OPTS} ${LUSTRE_DKMS_CONFIGURE_EXTRA}" + if [[ -n ${LUSTRE_DKMS_WEAK_MODULES} ]] ; then + [[ ${LUSTRE_DKMS_WEAK_MODULES,,} == @(y|yes) ]] && + no_weak_modules="no" + fi fi echo "${OPTS} " | grep -E -q -- '--disable-gss[^-]|--enable-gss[^-]' || dpkg -l | grep libkrb5-dev | grep -q ^ii && @@ -75,7 +93,7 @@ CONFIGURE="${CONFIGURE} --with-linux-obj=$kernel_source_dir ${OPTS}" MAKE="${AUTOGEN} && ${CONFIGURE} && make -j `nproc`" CLEAN="make distclean || true" -NO_WEAK_MODULES="yes" +NO_WEAK_MODULES="$no_weak_modules" AUTOINSTALL="yes" STRIP="no" @@ -121,7 +139,7 @@ int_mofed=no o2ib=$(echo ${OPTS} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-) if [[ "x$o2ib" = "xno" ]] ; then can_o2ib_in_kernel=no -elif [[ -f $o2ib ]] ; then +elif [[ -d $o2ib ]] ; then # User specified path, if the build completes it will be ext_ofed can_o2ib_mofed=yes ext_mofed=yes diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 0e87fd3..42b16ce 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -155,6 +155,8 @@ the repository with other debuginfo rpms. if [ "$RPM_BUILD_ROOT" != "/" ]; then rm -rf $RPM_BUILD_ROOT fi +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig +cp lustre/conf/dkms-lustre $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig mkdir -p $RPM_BUILD_ROOT/usr/src/ cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/ mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version} @@ -167,6 +169,7 @@ fi %files %defattr(-,root,root) /usr/src/%{module}-%{version} +%config(noreplace) %{_sysconfdir}/sysconfig/dkms-lustre %post dkms add -m %{module} -v %{version} %{!?not_rpm:--rpm_safe_upgrade} ||: diff --git a/lustre-dkms_pre-build.sh b/lustre-dkms_pre-build.sh index 7a4c2d2..d639a59 100755 --- a/lustre-dkms_pre-build.sh +++ b/lustre-dkms_pre-build.sh @@ -80,8 +80,10 @@ case $1 in ;; esac -PACKAGE_CONFIG="/etc/sysconfig/lustre" +PACKAGE_CONFIG="/etc/sysconfig/dkms-lustre" +PACKAGE_CONFIG_FALLBACK="/etc/sysconfig/lustre" DKMS_CONFIG_OPTS=$( + [[ -r ${PACKAGE_CONFIG} ]] || PACKAGE_CONFIG=${PACKAGE_CONFIG_FALLBACK} [[ -r ${PACKAGE_CONFIG} ]] \ && source ${PACKAGE_CONFIG} \ && shopt -q -s extglob \ diff --git a/lustre.spec.in b/lustre.spec.in index 26aa264..3f85a18 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -898,6 +898,7 @@ echo '%{_unitdir}/lnet.service' >>lustre.files echo '%{_unitdir}/lsvcgss.service' >>lustre.files %endif +# vendor is redhat %if "%{_vendor}" == "redhat" || 0%{?openEuler} # The following scripts are Red Hat specific %if %{with servers} @@ -913,6 +914,8 @@ echo '%config(noreplace) %{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files echo '%{_sysconfdir}/init.d/lnet' >>lustre.files %endif %endif +# End: vendor is redhat + %if %{with gss_keyring} echo '%config(noreplace) %{_sysconfdir}/request-key.d/lgssc.conf' >>lustre.files %endif @@ -1004,6 +1007,7 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %files -f lustre.files %defattr(-,root,root) +%exclude %{_sysconfdir}/sysconfig/dkms-lustre %{_sbindir}/* %if %{with lustre_tests} %exclude %{_sbindir}/wirecheck diff --git a/lustre/conf/Makefile.am b/lustre/conf/Makefile.am index dde1133..b26bc94 100644 --- a/lustre/conf/Makefile.am +++ b/lustre/conf/Makefile.am @@ -15,10 +15,12 @@ SUBDIRS = resource DIST_SUBDIRS = resource EXTRA_DIST = lustre.xml 99-lustre.rules lustre ldev.conf ko2iblnd.conf \ - lsvcgss lnet_routes.conf lnet.conf lgssc.conf \ + lsvcgss lnet_routes.conf lnet.conf lgssc.conf dkms-lustre \ lnet-sysctl.conf 99-lustre-server.rules mount.client.params sysconf_DATA = lnet.conf +sysconfigdir = $(sysconfdir)/sysconfig +sysconfig_DATA = dkms-lustre if UTILS sysconf_DATA += lnet_routes.conf @@ -37,8 +39,7 @@ if ZFS_ENABLED sysconf_DATA += ldev.conf endif if RHEL -sysconfigdir = $(sysconfdir)/sysconfig -sysconfig_DATA = lustre +sysconfig_DATA += lustre if GSS_KEYRING sysconfig_DATA += lsvcgss endif diff --git a/lustre/conf/dkms-lustre b/lustre/conf/dkms-lustre new file mode 100644 index 0000000..c31c2a2 --- /dev/null +++ b/lustre/conf/dkms-lustre @@ -0,0 +1,49 @@ + +## DKMS ## + +# Options specific to DKMS configure and install: + +# Installation options + +#LUSTRE_DKMS_WEAK_MODULES=no +# default is to not use weak-modules +# specify yes here invoke weak-modules support + +#LUSTRE_DKMS_DISABLE_STRIP=y +#LUSTRE_DKMS_ENABLE_STRIP=n +# if kernel modules are to be stripped of debugging information +# unset: default is not strip kernel objects + +# Configuration options + +#LUSTRE_DKMS_DISABLE_CDEBUG=yes +# yes: configure with --disable-libcfs-cdebug +# no: configure with --enable-libcfs-cdebug +# unset: use configure default + +#LUSTRE_DKMS_DISABLE_TRACE=y +# yes: configure with --disable-libcfs-trace +# no: configure with --enable-libcfs-trace +# unset: use configure default + +#LUSTRE_DKMS_DISABLE_ASSERT=y +# yes: configure with --disable-libcfs-assert +# no: configure with --enable-libcfs-assert +# unset: use configure default + +#LUSTRE_DKMS_ENABLE_GSS=y +# yes: configure with --enable-gss +# unset: +# if krb5-devel or libkb5-dev package installed configure with --enable-gss +# otherwise use configure default + +#LUSTRE_DKMS_ENABLE_GSS_KEYRING=y +# yes: configure with --enable-gss-keyring +# unset: use configure default + +#LUSTRE_DKMS_ENABLE_CRYPTO=y +# yes: configure with --enable-crypto +# unset, or no: configure with --disable-crypto + +#LUSTRE_DKMS_CONFIGURE_EXTRA='--enable-cache' +# adds any user specified arguments to configure diff --git a/lustre/scripts/dkms.mkconf b/lustre/scripts/dkms.mkconf index 875f6a8..697afa6 100755 --- a/lustre/scripts/dkms.mkconf +++ b/lustre/scripts/dkms.mkconf @@ -21,7 +21,8 @@ fi cat >${filename} <>${filename} <