Remove dependency on dlm

Also update license tags to SPDX compatible identifiers

Resolves: RHEL-54266
This commit is contained in:
Marian Csontos 2024-08-15 21:19:02 +02:00
parent 05150c5f57
commit bceb5e6eb9
9 changed files with 652 additions and 27 deletions

9
gating.yaml Normal file
View File

@ -0,0 +1,9 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
# TODO: This is not automated yet and it's not easy to run, so we agreed
# with QE we will not run these for 8.1
#- !PassingTestCaseRule {test_case_name: manual.sst_platform_storage.lvm2.manual-sts-tier1}

View File

@ -12,25 +12,19 @@
%global enable_integrity 1 %global enable_integrity 1
%global system_release_version 23 %global system_release_version 23
%global systemd_version 247-1 %global systemd_version 256
%global dracut_version 002-18 %global dracut_version 002-18
%global util_linux_version 2.24 %global util_linux_version 2.24
%global bash_version 4.0 %global bash_version 4.0
%global corosync_version 1.99.9-1 %global corosync_version 1.99.9-1
%global resource_agents_version 3.9.5-12 %global resource_agents_version 3.9.5-12
%global dlm_version 4.0.6-1
%global libselinux_version 1.30.19-4 %global libselinux_version 1.30.19-4
%global persistent_data_version 0.7.0-0.1.rc6 %global persistent_data_version 0.7.0-0.1.rc6
%global sanlock_version 3.3.0-2 %global sanlock_version 3.3.0-2
%global enable_lockd_sanlock %{enable_lvmlockd} %global enable_lockd_sanlock %{enable_lvmlockd}
%global enable_lockd_dlm %{enable_lvmlockd}
%if 0%{?rhel} && 0%{?rhel} <= 8 %if 0%{?rhel} && 0%{?rhel} <= 8
%ifnarch i686 x86_64 ppc64le s390x
%global enable_lockd_dlm 0
%endif
%ifnarch x86_64 ppc64 aarch64 %ifnarch x86_64 ppc64 aarch64
%global enable_lockd_sanlock 0 %global enable_lockd_sanlock 0
%endif %endif
@ -49,7 +43,7 @@ Epoch: %{rhel}
%endif %endif
Version: 2.03.24 Version: 2.03.24
Release: %autorelease Release: %autorelease
License: GPLv2 License: GPL-2.0-only
URL: https://sourceware.org/lvm2 URL: https://sourceware.org/lvm2
Source0: https://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz Source0: https://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
Patch1: 0001-RHEL9.patch Patch1: 0001-RHEL9.patch
@ -72,9 +66,6 @@ BuildRequires: libblkid-devel >= %{util_linux_version}
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: libedit-devel BuildRequires: libedit-devel
BuildRequires: libaio-devel BuildRequires: libaio-devel
%if %{enable_lockd_dlm}
BuildRequires: dlm-devel >= %{dlm_version}
%endif
BuildRequires: module-init-tools BuildRequires: module-init-tools
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: systemd-devel BuildRequires: systemd-devel
@ -150,9 +141,6 @@ or more physical volumes and creating one or more logical volumes
%if %{enable_lvmpolld} %if %{enable_lvmpolld}
--enable-lvmpolld \ --enable-lvmpolld \
%endif %endif
%if %{enable_lockd_dlm}
--enable-lvmlockd-dlm --enable-lvmlockd-dlmcontrol \
%endif
%if %{enable_lockd_sanlock} %if %{enable_lockd_sanlock}
--enable-lvmlockd-sanlock \ --enable-lvmlockd-sanlock \
%endif %endif
@ -392,7 +380,7 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
############################################################################## ##############################################################################
%package devel %package devel
Summary: Development libraries and headers Summary: Development libraries and headers
License: LGPLv2 License: LGPL-2.1-only
Requires: %{name} = %{?epoch}:%{version}-%{release} Requires: %{name} = %{?epoch}:%{version}-%{release}
Requires: device-mapper-devel = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper-devel = %{?epoch}:%{device_mapper_version}-%{release}
Requires: device-mapper-event-devel = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper-event-devel = %{?epoch}:%{device_mapper_version}-%{release}
@ -409,7 +397,7 @@ the lvm2 libraries.
%package libs %package libs
Summary: Shared libraries for lvm2 Summary: Shared libraries for lvm2
License: LGPLv2 License: LGPL-2.1-only
Requires: device-mapper-event = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper-event = %{?epoch}:%{device_mapper_version}-%{release}
%description libs %description libs
@ -440,16 +428,13 @@ This package contains shared lvm2 libraries for applications.
############################################################################## ##############################################################################
# LVM locking daemon # LVM locking daemon
############################################################################## ##############################################################################
%if %{enable_lockd_dlm} || %{enable_lockd_sanlock} %if %{enable_lockd_sanlock}
%package lockd %package lockd
Summary: LVM locking daemon Summary: LVM locking daemon
Requires: lvm2 = %{?epoch}:%{version}-%{release} Requires: lvm2 = %{?epoch}:%{version}-%{release}
%if %{enable_lockd_sanlock} %if %{enable_lockd_sanlock}
Requires: sanlock-lib >= %{sanlock_version} Requires: sanlock-lib >= %{sanlock_version}
%endif %endif
%if %{enable_lockd_dlm}
Requires: dlm-lib >= %{dlm_version}
%endif
Requires(post): systemd-units >= %{systemd_version} Requires(post): systemd-units >= %{systemd_version}
Requires(preun): systemd-units >= %{systemd_version} Requires(preun): systemd-units >= %{systemd_version}
Requires(postun): systemd-units >= %{systemd_version} Requires(postun): systemd-units >= %{systemd_version}
@ -484,7 +469,7 @@ LVM commands use lvmlockd to coordinate access to shared storage.
%package dbusd %package dbusd
Summary: LVM2 D-Bus daemon Summary: LVM2 D-Bus daemon
License: GPLv2 License: GPL-2.0-only
BuildArch: noarch BuildArch: noarch
Requires: lvm2 >= %{?epoch}:%{version}-%{release} Requires: lvm2 >= %{?epoch}:%{version}-%{release}
Requires: dbus Requires: dbus
@ -524,7 +509,7 @@ Daemon for access to LVM2 functionality through a D-Bus interface.
%package -n device-mapper %package -n device-mapper
Summary: Device mapper utility Summary: Device mapper utility
Version: %{device_mapper_version} Version: %{device_mapper_version}
License: GPLv2 License: GPL-2.0-only
URL: https://www.sourceware.org/dm/ URL: https://www.sourceware.org/dm/
Requires: device-mapper-libs = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper-libs = %{?epoch}:%{device_mapper_version}-%{release}
Requires: util-linux-core >= %{util_linux_version} Requires: util-linux-core >= %{util_linux_version}
@ -558,7 +543,7 @@ for the kernel device-mapper.
%package -n device-mapper-devel %package -n device-mapper-devel
Summary: Development libraries and headers for device-mapper Summary: Development libraries and headers for device-mapper
Version: %{device_mapper_version} Version: %{device_mapper_version}
License: LGPLv2 License: LGPL-2.1-only
Requires: device-mapper = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper = %{?epoch}:%{device_mapper_version}-%{release}
Requires: pkgconfig Requires: pkgconfig
@ -574,7 +559,7 @@ the device-mapper libraries.
%package -n device-mapper-libs %package -n device-mapper-libs
Summary: Device-mapper shared library Summary: Device-mapper shared library
Version: %{device_mapper_version} Version: %{device_mapper_version}
License: LGPLv2 License: LGPL-2.1-only
Requires: device-mapper = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper = %{?epoch}:%{device_mapper_version}-%{release}
%description -n device-mapper-libs %description -n device-mapper-libs
@ -622,7 +607,7 @@ fi
%package -n device-mapper-event-libs %package -n device-mapper-event-libs
Summary: Device-mapper event daemon shared library Summary: Device-mapper event daemon shared library
Version: %{device_mapper_version} Version: %{device_mapper_version}
License: LGPLv2 License: LGPL-2.1-only
%description -n device-mapper-event-libs %description -n device-mapper-event-libs
This package contains the device-mapper event daemon shared library, This package contains the device-mapper event daemon shared library,
@ -637,7 +622,7 @@ libdevmapper-event.
%package -n device-mapper-event-devel %package -n device-mapper-event-devel
Summary: Development libraries and headers for the device-mapper event daemon Summary: Development libraries and headers for the device-mapper event daemon
Version: %{device_mapper_version} Version: %{device_mapper_version}
License: LGPLv2 License: LGPL-2.1-only
Requires: device-mapper-event = %{?epoch}:%{device_mapper_version}-%{release} Requires: device-mapper-event = %{?epoch}:%{device_mapper_version}-%{release}
Requires: pkgconfig Requires: pkgconfig
@ -657,7 +642,7 @@ the device-mapper event library.
%package testsuite %package testsuite
Summary: LVM2 Testsuite Summary: LVM2 Testsuite
# Most of the code is GPLv2, the harness in test/lib/{brick-shelltest.h,runner.cpp} is BSD, and C files in test/api are LGPLv2... # Most of the code is GPLv2, the harness in test/lib/{brick-shelltest.h,runner.cpp} is BSD, and C files in test/api are LGPLv2...
License: LGPLv2 and GPLv2 and BSD-2-Clause License: GPL-2.0-only AND LGPL-2.1-only AND BSD-2-Clause
%description testsuite %description testsuite
An extensive functional testsuite for LVM2. An extensive functional testsuite for LVM2.
@ -670,6 +655,12 @@ An extensive functional testsuite for LVM2.
%endif %endif
%changelog %changelog
* Wed Aug 21 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.24-3
- Remove dlm.
* Thu Aug 15 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.24-2
- Update License tags to SPDX compliant identifiers.
* Thu Aug 15 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.24-1 * Thu Aug 15 2024 Marian Csontos <mcsontos@redhat.com> - 2.03.24-1
- Update to upstream version 2.03.24. - Update to upstream version 2.03.24.
- See WHATS_NEW and WHATS_NEW_DM for more information. - See WHATS_NEW and WHATS_NEW_DM for more information.

63
tests/collect_output.sh Normal file
View File

@ -0,0 +1,63 @@
#!/bin/bash
set -xv
DIR="$1"
LIST="$2"
[[ -n "$DIR" ]] || {
echo "ERROR: Missing DIR" >&2
exit 1
}
cd "$DIR"
# TODO: use find and xargs (?)
passed_logs() {
grep '\(passed\|skipped\|warnings\)$' list | sed 's|/|_|' | sed 's| .*|.txt|'
}
# Remove log file if the test succeeded (we are generating tons of logs)
echo "Removing output of passed tests..."
#passed_logs
for f in $(passed_logs); do
#echo " $f"
rm -f "$f"
done
# rm -f $(passed_logs)
if [[ -n "$LIST" ]]; then
cat list >> "$LIST"
fi
# Remove empty files and compress the rest:
for f in *.txt; do
if [[ -s "$f" ]]; then
echo "Compressing file '$f'..."
ls -l "$f"
gzip "$f"
ls -l "$f.gz"
else
echo "Removing empty file '$f'"
ls -l "$f"
rm -f "$f"
fi
done
for f in *.gz; do
if [[ -f "$f" ]]; then
# Use tar so we do not transfer dozens of small files:
tar cvf "logfiles.tar" *.gz
# Clean up:
rm -f *.gz
exit 1
fi
done

30
tests/get_lvm2_tarball.sh Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/sh
set -e
PKG=$1
[[ "$PKG" == lvm2 ]]
CHECK=false
cat sources | \
while read SHA512_HEADER TARBALL EQUAL HASH; do
if [[ "$SHA512_HEADER" == SHA512 ]]; then
TARBALL=$(echo $TARBALL |sed 's/.\(.*\)./\1/')
CHECK="sha512sum"
else
HASH="$SHA512_HEADER"
CHECK="md5sum"
fi
if [[ -f "$TARBALL" ]] && "$CHECK" -c sources; then
echo "File already downloaded and verified"
else
URL="https://sourceware.org/pub/$PKG/releases/$TARBALL"
echo "Fetching '$URL'..."
curl -k -o "$TARBALL" "$URL"
echo "Checking hash of '$TARBALL'..."
"$CHECK" -c sources
fi
done

View File

@ -0,0 +1,85 @@
#!/bin/bash
set -e
set -xv
# TODO: Use the role!
dnf install -y mock
# lsblk and blkid:
dnf install -y util-linux
# rpmbuild and rpmdev-setuptree
dnf install -y rpmdevtools rpm-build
# mock:
dnf install -y mock
# gather info about the system and environment:
set
pwd
ls -al
uname -a
rpm -qa | grep -F lvm2 | :
rpm -qa | grep -F device-mapper | :
which lsblk | :
lsblk | :
which blkid | :
blkid | :
find / -name lvm2.spec
# NOTE: The following does not work - it will download src.rpm from default repo, not the one under test...
#################################################################################
## compile the test suite - using rpmbuild and mock
#################################################################################
#rpmdev-setuptree
#
#dnf download --source lvm2
#rpm -ivh lvm2*.src.rpm
#
#find / -name '*.patch'
#exit 0
##rpmbuild -bs
################################################################################
# compile the test suite - using mock
################################################################################
if [[ -f lvm2.spec ]]; then
mock_profile() {
(
ID=
VERSION_ID=
source /etc/os-release ""
[[ -n "$ID" && -n "$VERSION_ID" ]] || exit 1
echo "${ID}-${VERSION_ID}-$(arch)"
)
}
MOCK_PROFILE="$(mock_profile)"
rm -rf "/var/lib/mock/$MOCK_PROFILE/result/"
#mock -r "$MOCK_PROFILE" --init
#mock -r "$MOCK_PROFILE" --installdeps lvm2.spec
# FIXME: /var/str is controlled by tenv_workdir ansible variable - need an env.variable!
#mock -r "$MOCK_PROFILE" --buildsrpm --no-clean --spec lvm2.spec --sources "/var/str/source" --short-circuit=build
#ls -l
find / -name 'lvm2*.src.rpm'
mock -r "$MOCK_PROFILE" --rebuild --no-clean ~/rpmbuild/SRPMS/lvm2*.src.rpm
find / -name 'lvm2-2*.rpm'
[[ -n $(find / -name 'lvm2-testsuite-2*.rpm') ]]
ls -l
#dnf install -y ~/rpmbuild/RPMS/lvm2-testsuite-*.rpm
dnf install -y /var/lib/mock/"$MOCK_PROFILE"/result/lvm2-testsuite-2*.rpm
fi

6
tests/provision.fmf Normal file
View File

@ -0,0 +1,6 @@
---
# lvm2 testsuite requires at least 2G of RAM to run smoothly in /dev/shm
standard-inventory-qcow2:
qemu:
m: 3G

16
tests/refresh.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
refresh_dirs() {
local dir=
while [[ -n "$*" ]]; do
if [[ -d "$1" ]]; then
rm -rf "$1"
fi
mkdir -p "$(dirname "$1")"
mkdir "$1"
shift
done
}
refresh_dirs ~/rpmbuild/SRPMS ~/rpmbuild/RPMS
refresh_dirs /tmp/source

77
tests/run_tests.yml Normal file
View File

@ -0,0 +1,77 @@
---
- name: Echo test header
shell: |
MSG="Running test case {{ test_case }}"
echo "*** $MSG ***" >/dev/console
logger -p user.notify "$MSG"
true
- name: Create artifacts directory
file:
state: directory
path: "{{ remote_artifacts }}/{{ test_case }}"
- name: Run the testsuite
# lvm2-testsuite --batch --flavours "{{ flavours.stdout_lines|join(',')}}" --only "{{ run_tests|default([])|join(',') }}" --skip "{{ skip_tests|default([])|join(',') }}" 2>&1 | tee "lvm2-testsuite.out"
shell: |
# Run testsuite in RAM disk:
mkdir -p /dev/shm/lvm2-slave
export LVM_TEST_DIR=/dev/shm/lvm2-slave
mount -o remount,dev /dev/shm
# Protection against some of our non-deterministic tests
# TODO: Add diff for each test run, so it is easier to tell whether test is broken, or there is an issue
RESULT=1
ITERATION=0
while [[ "$RESULT" -ne 0 && "$ITERATION" -lt {{ iterations|default(3) }} ]]; do
let ITERATION++
mkdir "$ITERATION"
cd "$ITERATION"
echo "Running iteration $ITERATION..."
lvm2-testsuite --batch --flavours "{{ flavours.stdout_lines|join(',')}}" --only "{{ test_case }}" 2>&1 | tee "lvm2-testsuite.out"
RESULT="${PIPESTATUS[0]}"
cd ".."
done
cp -R "$ITERATION"/* "."
exit "$RESULT"
args:
chdir: "{{ remote_artifacts }}/{{ test_case }}"
register: lvm2_testsuite_run
ignore_errors: yes
- name: Collect artifacts
shell: |
"{{ workdir }}/collect_output.sh" "{{ remote_artifacts }}/{{ test_case }}" "{{ remote_artifacts }}/list"
ignore_errors: yes
register: lvm2_testsuite_results
#- name: Find artifacts
# find:
# path: "{{ remote_artifacts }}"
# patterns: "*.txt"
# register: artifacts_files
- name: Fetch output
fetch:
dest: "{{ artifacts }}/{{ test_case }}/"
src: "{{ remote_artifacts }}/{{ test_case }}/{{ logfile }}"
flat: yes
with_items:
- lvm2-testsuite.out
- journal
- list
- logfiles.tar
loop_control:
loop_var: logfile
when: lvm2_testsuite_results.failed
- name: Fetch list
fetch:
dest: "{{ artifacts }}/"
src: "{{ remote_artifacts }}/list"
flat: yes
- name: Summary
shell: |
cut -d" " -f2 "{{ remote_artifacts }}/list" | sort | uniq -c
grep "failed$" "{{ remote_artifacts }}/list" || :

348
tests/tests.yml Normal file
View File

@ -0,0 +1,348 @@
- hosts: localhost
vars:
workdir: /tmp/testwd
remote_artifacts: /tmp/testwd/artifacts
srcdir: /tmp/source
package: lvm2
fetch_all: true
#fetch_gzip: true
#fetch_tar: true
install_packages: true
#filter_flavours: '| grep -v "lockd\|polld"' # Ignore lockd and polld
filter_flavours: '| grep "vanilla"' # Run vanilla only
#run_tests:
# - vg
ignore_failures:
# tests need updating - remove after verified:
- lvconvert-thin.sh
- lvcreate-cache.sh
- lvcreate-thin-big.sh
# unstable results - should be warnings only
- lvconvert-cache-abort.sh
- lvconvert-mirror.sh
- dmeventd-restart.sh # TODO: could be an issue!
- nomda-restoremissing.sh # Unstable test, investigate
- api/dbus # New experimental VDO code not working yet
- open-file-limit.sh # Unstable test
# these are known issues with md not cleaning up after itself:
#- shell/duplicate-pvs-md0.sh
#- shell/duplicate-pvs-md1.sh
- shell/integrity # An unknown issue, likely in kernel
- writecache-blocksize # A new test not working properly
- system_id.sh
# issue with new kernel metadata format - need better way how to make thin meta corrupted:
- shell/lvconvert-repair-policy.sh
- shell/lvconvert-repair-thin.sh
- shell/thin-foreign-dmeventd.sh
- shell/lvresize-fs-crypt.sh
skip_tests:
- read-ahead.sh # tuned is interfering with tests
- shell/inconsistent-metadata.sh # Requires more space in /dev/mapper
# VDO is not supported yet:
#- vdo # no vdo in el9 yet
#- lvconvert-cache-vdo.sh # TODO: likely an issue!
#- lvcreate-vdo-cache.sh # TODO: likely an issue!
- lvconvert-cache-abort.sh # TODO: likely an issue!
# TODO: Check and update list of known issues and unstable tests
- shell/000-basic.sh # this fails if there is different version of installed lvm2 and lvm2-testsuite (and we do not want this to fail gating)
- shell/fsadm-crypt.sh # broken on RHEL-8 - requires input on stdin
- lvconvert-raid-reshape.sh # blocking forever today, worked fine on Monday. kernel issue?
# these are known issues with md not cleaning up after itself:
#- shell/duplicate-pvs-md0.sh
#- shell/duplicate-pvs-md1.sh
- shell/lvconvert-raid-takeover.sh # did this ever work?
- shell/lvm-on-md.sh # check the test!
- shell/thin-flags.sh # check the test!
- shell/inconsistent-metadata.sh # In CI ends with "No space left on device"
# these may take considerable amount of time and consume lot of RAM - we are running these on our infrastructure:
# vgchange-many does not work in CI - it is timing out writing large amounts of data
- shell/vgchange-many.sh
#- shell/vgcreate-many-pvs.sh
#- shell/thin-many-dmeventd.sh
# NOTE: Uncomment the following to quickly check the test itself is working
#- vg
#- lv
#- pv
#- raid
#- mirror
#- python
#- poll
#- thin
#- scan
#- dbus
#
tags:
- classic
tasks:
- name: Set variables
set_fact:
artifacts: "{{ artifacts|default(lookup('env', 'TEST_ARTIFACTS') or './artifacts') }}"
- name: str-common-init
include_role:
name: str-common-init
- name: Install basic tools
dnf:
name:
- python3-libselinux
- sed
- tar
- util-linux
- psmisc # killall is required by testsuite
- nmap-ncat # nc required by lvmpolld tests (or socat)
- binutils # strings is required by some tests
- strace
- vim-common # xxd required by some tests
- mdadm
# No vdo package in EL9 yet
# - https://issues.redhat.com/browse/RHELPLAN-77194
- vdo
- kmod-kvdo
state: present
- name: See RAM and disks
shell: |
set -xv
free
mount
df
lsblk
true
- name: Install rsync on localhost
dnf:
name: rsync
state: present
delegate_to: 127.0.0.1
ignore_errors: yes
register: has_rsync
- name: Install rsync on remote
dnf:
name: rsync
state: present
- name: Create workdir
file:
state: directory
path: "{{ workdir }}"
mode: 0755
- name: Copy scripts to remote machine
copy:
src: "{{ playbook_dir }}/{{ item }}"
dest: "{{ workdir }}/"
mode: 0755
with_items:
- get_lvm2_tarball.sh
- refresh.sh
- collect_output.sh
#- mock_build_and_test.sh
- name: Check lvm2-testsuite is present
dnf:
name: lvm2-testsuite
state: present
ignore_errors: yes
register: lvm2_testsuite
- name: Build and install lvm2-testsuite if not available
when: lvm2_testsuite.failed
block:
- name: Make sure dependencies for retrieving the sources are installed
dnf:
name:
- curl
- wget
- rpm-build
- xz
#- mock
- rpmdevtools
- make
- name: Copy spec file to remote machine
copy:
src: "{{ playbook_dir }}/../{{package}}.spec"
dest: "{{ workdir }}/"
# - name: Display path to patches
# debug:
# msg: "{{ playbook_dir + '/../*.patch' }}"
#
# - name: Display patches
# debug:
# msg: "{{ lookup('fileglob', playbook_dir + '/../*.patch') }}"
- name: Copy patches to remote machine
copy:
src: "{{ item }}"
dest: "{{ workdir }}/"
with_fileglob: "{{ playbook_dir }}/../*.patch"
- name: Copy sources file to remote machine
copy:
src: "{{ playbook_dir }}/../sources"
dest: "{{ workdir }}/"
- name: Enable testsuite in the spec file
shell: |
sed -i 's/enable_testsuite .*/enable_testsuite 1/' lvm2.spec
args:
chdir: "{{ workdir }}"
# This would be handled by mock if available. And is not needed at all on Fedora
# TODO: Use conditional for the Fedora part!
- name: Enable buildroot repo
shell: dnf -y config-manager --set-enabled rhel-buildroot
ignore_errors: yes
- name: Install build deps
shell: dnf -y build-dep {{ workdir }}/{{ package }}.spec
- name: Run the refresh script
shell: |
./refresh.sh
args:
chdir: "{{ workdir }}"
- name: Run the source-retrieval script
shell: |
./get_lvm2_tarball.sh {{ package }}
args:
chdir: "{{ workdir }}"
- name: Build RPMs
shell: |
#rpmbuild -bp lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
#rpmbuild -bs lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
rpmbuild -ba lvm2.spec --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_builddir {{ srcdir }}"
args:
chdir: "{{ workdir }}"
- name: Install lvm2-testsuite
shell: |
dnf install -y /root/rpmbuild/RPMS/$(uname -m)/lvm2-testsuite-2.*.rpm
args:
chdir: '{{ workdir }}'
# - name: Build and install lvm2-testsuite
# shell: |
# ./mock_build_and_test.sh
# args:
# chdir: "{{ workdir }}"
- name: Install lvm2 packages if requested
dnf:
state: present
name:
- lvm2
- lvm2-lockd
- lvm2-dbusd
- device-mapper-event
when: install_packages|default(false)
- name: Disable services interfering with tests
systemd:
name: "{{item}}"
masked: yes
enabled: no
state: stopped
ignore_errors: yes
with_items:
- lvm2-lvmpolld.service
- lvm2-lvmpolld.socket
- lvm2-monitor.service
- dm-event.socket
- dm-event.service
- lvm2-pvscan@.service
# The above systemd module does not like templates...
- name: Disable pvscan service
shell: |
systemctl mask lvm2-pvscan@.service
ignore_errors: yes
- name: Disable monitoring
shell: |
sed -i 's/monitoring *= *.*/monitoring = 0/' /etc/lvm/lvm.conf
- name: Check environment
shell: |
lvmconfig --typeconfig diff
systemctl -a
- name: Create artifacts directory
file:
state: directory
path: "{{ remote_artifacts }}"
- name: Gather flavours
shell: |
ls -1 flavour-udev-* | grep -v "lvmlockd-dlm\|lvmlockd-sanlock" {{ filter_flavours|default('') }} | sed 's/^flavour-//'
args:
chdir: /usr/share/lvm2-testsuite/lib
register: flavours
# - name: Find flavours
# find:
# contains: '^flavour-'
# paths: /usr/share/lvm2-testsuite/lib
# register: flavours
# # TODO: should use flavours.files when using find module, must drop flavour- prefix
# - name: Debug flavours
# debug:
# var: flavours
#
# - name: Debug skip
# debug:
# msg: |
# '\({{ skip_tests|join("\|") }}\)'
- name: Gather tests
shell: |
find . -name "*.sh" | sed 's/^\.\///' | grep -v '\({{ skip_tests|default(["qwqwasdf"])|join("\|") }}\)' | grep '\({{ run_tests|default(["."])|join("\|") }}\)' | sort
args:
chdir: /usr/share/lvm2-testsuite
register: lvm2_tests
# - name: Debug lvm2_tests
# debug:
# var: lvm2_tests
- name: Run tests
include_tasks: run_tests.yml
with_items: "{{ lvm2_tests.stdout_lines }}"
loop_control:
loop_var: test_case
# NOTE: test.log is required by CI - shall we append to it?
- name: Fetch list with results as test.log
fetch:
dest: "{{ artifacts }}/test.log"
src: "{{ remote_artifacts }}/list"
flat: yes
# - name: Check artifacts size on remote
# shell: |
# du -s "{{ remote_artifacts }}/"
#
# - name: Check artifacts size on local
# shell: |
# du -s "{{ artifacts }}/"
# delegate_to: 127.0.0.1
- name: Report failures
shell: |
! grep -v '\(passed\|skipped\|warnings\)' "{{ remote_artifacts }}/list" | grep -v '\({{ ignore_failures|default(["qwqwasdf"])|join("\|") }}\)'