Initial build for EL9 (Version 8.1.0.1)

Related: rhbz#1955374
This commit is contained in:
Andrew Walsh 2021-05-04 19:16:26 +00:00
parent 7f19c65256
commit ca530f349b
11 changed files with 552 additions and 0 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

157
kmod-kvdo.spec Normal file
View File

@ -0,0 +1,157 @@
%global commit 55349be2df7dc6076ff94fbafcdb8f3cfabb589b
%global gittag 8.1.0.1
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%define spec_release 1
%define kmod_name kvdo
%define kmod_driver_version %{gittag}
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 5.12.0-1.el9
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//')
%define kmod_kbuild_dir .
%define kmod_devel_package 0
Source0: https://github.com/dm-vdo/%{kmod_name}/archive/%{commit}/%{kmod_name}-%{shortcommit}.tar.gz
%define findpat %( echo "%""P" )
Name: kmod-kvdo
Version: %{kmod_driver_version}
Release: %{kmod_rpm_release}%{?dist}
Summary: Kernel Modules for Virtual Data Optimizer
License: GPLv2+
URL: http://github.com/dm-vdo/kvdo
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: elfutils-libelf-devel
BuildRequires: glibc
BuildRequires: kernel-devel >= %{kmod_kernel_version}
# Disable the kernel-debug requirement for now
BuildRequires: libuuid-devel
BuildRequires: redhat-rpm-config
ExcludeArch: i686
ExcludeArch: ppc
ExcludeArch: ppc64
ExcludeArch: s390
%global kernel_source() /usr/src/kernels/%{kmod_headers_version}
%global _use_internal_dependency_generator 0
Provides: kernel-modules = %{kmod_kernel_version}.%{_target_cpu}
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires(post): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
Requires: kernel >= %{kmod_kernel_version}
Requires: kernel-core-uname-r >= %{kmod_kernel_version}
%description
Virtual Data Optimizer (VDO) is a device mapper target that delivers
block-level deduplication, compression, and thin provisioning.
This package provides the kernel modules for VDO.
%pre
# During the install, check whether kvdo or uds is loaded. A warning here
# indicates that a previous install was not completely removed. This message
# is purely informational to the user.
for module in kvdo uds; do
if grep -q "^${module}" /proc/modules; then
if [ "${module}" == "kvdo" ]; then
echo "WARNING: Found ${module} module previously loaded (Version: $(cat /sys/kvdo/version 2>/dev/null || echo Unknown)). A reboot is recommended before attempting to use the newly installed module."
else
echo "WARNING: Found ${module} module previously loaded. A reboot is recommended before attempting to use the newly installed module."
fi
fi
done
%post
modules=( $(find /lib/modules/%{kmod_headers_version}/extra/kmod-%{kmod_name} | grep '\.ko$') )
printf '%s\n' "${modules[@]}" >> /var/lib/rpm-kmod-posttrans-weak-modules-add
%pretrans -p <lua>
posix.unlink("/var/lib/rpm-kmod-posttrans-weak-modules-add")
%posttrans
if [ -f "/var/lib/rpm-kmod-posttrans-weak-modules-add" ]; then
modules=( $(cat /var/lib/rpm-kmod-posttrans-weak-modules-add) )
rm -rf /var/lib/rpm-kmod-posttrans-weak-modules-add
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracut --add-modules
fi
%preun
rpm -ql kmod-kvdo-%{kmod_driver_version}-%{kmod_rpm_release}%{?dist}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-%{kmod_name}-modules
# Check whether kvdo or uds is loaded, and if so attempt to remove it. A
# failure to unload means there is still something using the module. To make
# sure the user is aware, we print a warning with recommended instructions.
for module in kvdo uds; do
if grep -q "^${module}" /proc/modules; then
warnMessage="WARNING: ${module} in use. Changes will take effect after a reboot."
modprobe -r ${module} 2>/dev/null || echo ${warnMessage} && /usr/bin/true
fi
done
%postun
modules=( $(cat /var/run/rpm-kmod-%{kmod_name}-modules) )
rm /var/run/rpm-kmod-%{kmod_name}-modules
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracut --remove-modules
%files
%defattr(644,root,root,755)
/lib/modules/%{kmod_headers_version}
/etc/depmod.d/%{kmod_name}.conf
/usr/share/doc/kmod-%{kmod_name}/greylist.txt
%prep
%setup -n %{kmod_name}-%{commit}
%{nil}
set -- *
mkdir source
mv "$@" source/
mkdir obj
%build
rm -rf obj
cp -r source obj
make -C %{kernel_source} M=$PWD/obj/%{kmod_kbuild_dir} V=1 \
NOSTDINC_FLAGS="-I $PWD/obj/include -I $PWD/obj/include/uapi"
# mark modules executable so that strip-to-file can strip them
find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -exec chmod u+x '{}' +
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
for modules in $( find obj/%{kmod_kbuild_dir} -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
# update depmod.conf
module_weak_path=$(echo $modules | sed 's/[\/]*[^\/]*$//')
if [ -z "$module_weak_path" ]; then
module_weak_path=%{name}
else
module_weak_path=%{name}/$module_weak_path
fi
echo "override $(echo $modules | sed 's/.*\///') $(echo %{kmod_headers_version} | sed 's/\.[^\.]*$//').* weak-updates/$module_weak_path" >> source/depmod.conf
# update greylist
nm -u obj/%{kmod_kbuild_dir}/$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> source/greylist
done
done
sort -u source/greylist | uniq > source/greylist.txt
%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=extra/%{name}
make -C %{kernel_source} modules_install V=1 \
M=$PWD/obj/%{kmod_kbuild_dir}
# Cleanup unnecessary kernel-generated module dependency files.
find $INSTALL_MOD_PATH/lib/modules -iname 'modules.*' -exec rm {} \;
install -m 644 -D source/depmod.conf $RPM_BUILD_ROOT/etc/depmod.d/%{kmod_name}.conf
install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_name}/greylist.txt
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Tue May 04 2021 - Andy Walsh <awalsh@redhat.com> - 8.1.0.1-1
- Initial build for EL9
- Related: rhbz#1955374

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

4
tests/provision.fmf Normal file
View File

@ -0,0 +1,4 @@
---
standard-inventory-qcow2:
qemu:
m: 4G

62
tests/sanity/Makefile Normal file
View File

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /kernel/test_beakertask/Sanity/beaker_test
# Description: Install VDO
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/beaker_test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Andy Walsh <awalsh@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Loads VDO kernel modules" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: test_beakertask" >> $(METADATA)
@echo "Requires: test_beakertask" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/sanity/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE Test the kmod-kvdo packaged drivers
Description: Load the VDO modules into the kernel.
Author: Andy Walsh <awalsh@redhat.com>

62
tests/sanity/runtest.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of kmod-kvdo/sanity
# Description: Checking that the kmod-kvdo kernel modules can be loaded.
# Author: Andy Walsh <awalsh@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
rlPhaseStartSetup
# Collect information
rlLog "uname: $(uname -a)"
rlPhaseEnd
rlPhaseStartTest "Confirm modules are installed"
rlRun "find /lib/modules -type f -name uds.ko"
rlRun "find /lib/modules -type f -name kvdo.ko"
rlPhaseEnd
rlPhaseStartTest "Validate module information"
rlRun "modinfo -l uds"
rlRun "modinfo -l kvdo"
rlPhaseEnd
rlPhaseStartTest "Confirm the modules can be loaded"
rlRun "modprobe uds"
rlRun "lsmod | grep uds"
rlRun "modprobe kvdo"
rlRun "lsmod | grep kvdo"
rlPhaseEnd
rlPhaseStartCleanup "Unload the modules"
rlRun "modprobe -r kvdo"
rlRun "modprobe -r uds"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

62
tests/smoke/Makefile Normal file
View File

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /kernel/test_beakertask/Sanity/beaker_test
# Description: Install VDO
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/beaker_test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Andy Walsh <awalsh@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Installs VDO" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: test_beakertask" >> $(METADATA)
@echo "Requires: test_beakertask" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/smoke/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE Test the kmod-kvdo package for basic functionality
Description: Tests the VDO software for basic functionality.
Author: Andy Walsh <awalsh@redhat.com>

182
tests/smoke/runtest.sh Normal file
View File

@ -0,0 +1,182 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of VDO smoke test
# Description: Check that VDO is able to read/write data and start/stop
# Author: Andy Walsh <awalsh@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2018 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
function insertModuleWithDMesgOutput() {
moduleName=$1
modulePath=$(rpm -ql kmod-kvdo | grep "${1}.ko$")
exitVal=0
rlRun "dmesg -c > /dev/null"
rlRun "insmod ${modulePath}" || exitVal=255
rlRun "dmesg"
if [ ${exitVal} -ne 0 ]; then
rlDie "Exiting with failure due to module/kernel incompatibility"
fi
}
rlJournalStart
rlPhaseStartSetup "Create backing device"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "df ."
# If we end up with less than 15G of available space, then we can't
# create a VDO volume sufficient for testing. We should bail out as a
# result.
loopbackSize=$(($(df --sync --output=avail / | tail -1) * 1024 - 1024*1024*1024))
if [ ${loopbackSize} -lt $((1024*1024*1024*15)) ]; then
rlDie "Not enough space to create loopback device."
fi
rlRun "truncate -s ${loopbackSize} $TmpDir/loop0.bin" 0 "Laying out loopfile backing"
rlRun "losetup /dev/loop0 $TmpDir/loop0.bin" 0 "Creating loopdevice"
rlRun "mkdir -p /mnt/testmount" 0 "Creating test mountpoint dir"
rlPhaseEnd
rlPhaseStartTest "Gather Relevant Info"
# Gather some system information for debug purposes
rlRun "uname -a"
rlRun "find /lib/modules -name kvdo.ko"
rlRun "modinfo uds" || insertModuleWithDMesgOutput uds
rlRun "modinfo kvdo" || insertModuleWithDMesgOutput kvdo
rlPhaseEnd
rlPhaseStartTest "Generate Test Data"
# Write some data, check statistics
rlRun "dd if=/dev/urandom of=${TmpDir}/urandom_fill_file bs=1M count=100"
rlRun "ls -lh ${TmpDir}/urandom_fill_file"
rlPhaseEnd
for partition_type in "raw" "lvm" "part"
do
case $partition_type in
"raw"*)
backing_device=/dev/loop0
;;
"lvm"*)
rlPhaseStartTest "Create LVM backing device"
rlRun "pvcreate /dev/loop0" 0 "Creating PV"
rlRun "vgcreate vdo_base /dev/loop0" 0 "Creating VG"
rlRun "lvcreate -n vdo_base -l100%FREE vdo_base" 0 "Creating LV"
rlPhaseEnd
backing_device=/dev/vdo_base/vdo_base
;;
"part"*)
rlPhaseStartTest "Create partitioned backing device"
rlRun "parted -s /dev/loop0 mklabel msdos" 0 "Creating label"
rlRun 'parted -s /dev/loop0 mkpart primary "" 1M -- -1M' 0 "Creating partition"
rlPhaseEnd
backing_device=/dev/loop0p1
;;
*)
;;
esac
rlPhaseStartTest "Smoke Test"
# Create the VDO volume and get the initial statistics
rlRun "vdo create --name=vdo1 --device=${backing_device} --verbose" 0 "Creating VDO volume vdo1"
rlRun "vdostats vdo1"
# Create a filesystem and mount the device, check statistics
rlRun "mkfs.xfs -K /dev/mapper/vdo1" 0 "Making xfs filesystem on VDO volume"
rlRun "mount -o discard /dev/mapper/vdo1 /mnt/testmount" 0 "Mounting xfs filesystem on VDO volume"
rlRun "df --sync /mnt/testmount"
rlRun "vdostats vdo1"
# Copy the test data onto VDO volume 4 times to get some deduplication
for i in {1..4}
do
rlRun "cp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}"
done
rlRun "df --sync /mnt/testmount"
rlRun "vdostats vdo1"
# Verify the data
for i in {1..4}
do
rlRun "cmp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}"
done
# Unmount and stop the volume, check statistics
rlRun "umount /mnt/testmount" 0 "Unmounting testmount"
rlRun "vdostats vdo1"
rlRun "vdo stop --name=vdo1 --verbose" 0 "Stopping VDO volume vdo1"
# Start the VDO volume, mount it, check statistics, verify data.
rlRun "vdo start --name=vdo1 --verbose" 0 "Starting VDO volume vdo1"
rlRun "mount -o discard /dev/mapper/vdo1 /mnt/testmount" 0 "Mounting xfs filesystem on VDO volume"
rlRun "df --sync /mnt/testmount"
rlRun "vdostats vdo1"
# Verify the data
for i in {1..4}
do
rlRun "cmp ${TmpDir}/urandom_fill_file /mnt/testmount/test_file-${i}"
done
rlPhaseEnd
rlPhaseStartCleanup
rlRun "umount /mnt/testmount" 0 "Unmounting testmount"
rlRun "vdo remove --name=vdo1 --verbose" 0 "Removing VDO volume vdo1"
case $partition_type in
"lvm"*)
rlPhaseStartCleanup
rlRun "lvremove -ff ${backing_device}" 0 "Removing LV"
rlRun "vgremove vdo_base" 0 "Removing VG"
rlRun "pvremove /dev/loop0" 0 "Removing PV"
rlPhaseEnd
;;
"part"*)
rlPhaseStartCleanup
rlRun "parted -s /dev/loop0 rm 1" 0 "Removing partition"
rlPhaseEnd
;;
*)
;;
esac
rlRun "dd if=/dev/zero of=/dev/loop0 bs=1M count=10 oflag=direct" 0 "Wiping Block Device"
rlPhaseEnd
done
rlPhaseStartCleanup
rlRun "losetup -d /dev/loop0" 0 "Deleting loopdevice"
rlRun "rm -f $TmpDir/loop0.bin" 0 "Removing loopfile backing"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

10
tests/tests.yml Normal file
View File

@ -0,0 +1,10 @@
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-beakerlib
tests:
- sanity
- smoke
required_packages:
- vdo