diff --git a/tests/.fmf/version b/.fmf/version similarity index 100% rename from tests/.fmf/version rename to .fmf/version diff --git a/0021-Tell-LVM-DBus-to-refresh-its-internal-status-during-reset.patch b/0021-Tell-LVM-DBus-to-refresh-its-internal-status-during-reset.patch new file mode 100644 index 0000000..0db1138 --- /dev/null +++ b/0021-Tell-LVM-DBus-to-refresh-its-internal-status-during-reset.patch @@ -0,0 +1,65 @@ +From ee19e665276fd7cd6477da9bee59641b1de1a916 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Fri, 27 Jun 2025 11:28:09 +0200 +Subject: [PATCH] Tell LVM DBus to refresh it's internal status during reset + +Unfortunately some users run wipefs thinking it's enough +to remove all devices on top of the disk cleanly. +In cases where the PV is not directly on the disk, LVM DBus +doesn't get a udev event and doesn't remove the VG and LVs from +DBus so we think these still exist. + +Resolves: RHEL-93967 +--- + blivet/devicelibs/lvm.py | 19 +++++++++++++++++++ + blivet/populator/populator.py | 3 +++ + 2 files changed, 22 insertions(+) + +diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py +index 38e1bc1bc..47cc3e5d7 100644 +--- a/blivet/devicelibs/lvm.py ++++ b/blivet/devicelibs/lvm.py +@@ -36,6 +36,7 @@ + log = logging.getLogger("blivet") + + from . import raid ++from .. import safe_dbus + from ..size import Size + from ..i18n import N_ + from ..flags import flags +@@ -284,3 +285,21 @@ def recommend_thpool_chunk_size(thpool_size): + + def is_valid_cache_md_size(md_size): + return md_size >= LVM_CACHE_MIN_METADATA_SIZE and md_size <= LVM_CACHE_MAX_METADATA_SIZE ++ ++ ++def lvm_dbusd_refresh(): ++ lvm_soname = blockdev.get_plugin_soname(blockdev.Plugin.LVM) ++ if 'dbus' not in lvm_soname: ++ return ++ ++ try: ++ rc = safe_dbus.call_sync("com.redhat.lvmdbus1", ++ "/com/redhat/lvmdbus1/Manager", ++ "com.redhat.lvmdbus1.Manager", ++ "Refresh", ++ None) ++ except safe_dbus.DBusCallError as e: ++ log.error("Exception occurred when calling LVM DBusD refresh: %s", str(e)) ++ else: ++ if rc[0] != 0: ++ log.error("Failed to call LVM DBusD refresh: %s", rc) +diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py +index 2ddea6618..da3b33cac 100644 +--- a/blivet/populator/populator.py ++++ b/blivet/populator/populator.py +@@ -453,6 +453,9 @@ def _populate(self): + disklib.update_volume_info() + self.drop_device_info_cache() + ++ # force LVM DBusD to refresh its internal state ++ lvm.lvm_dbusd_refresh() ++ + if flags.auto_dev_updates and availability.BLOCKDEV_MPATH_PLUGIN.available: + blockdev.mpath.set_friendly_names(flags.multipath_friendly_names) + diff --git a/gating.yaml b/gating.yaml index 4ca9235..ef3bddb 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,4 +3,4 @@ product_versions: - rhel-10 decision_context: osci_compose_gate rules: - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tests.functional} diff --git a/plans/tests.fmf b/plans/tests.fmf new file mode 100644 index 0000000..0c5f7d3 --- /dev/null +++ b/plans/tests.fmf @@ -0,0 +1,37 @@ +summary: libblockdev gating tests + +prepare: + how: install + package: + - python3 + - python3-dbus + - libblockdev-plugins-all + - python3-yaml + - targetcli + - stratis-cli + - stratisd + +discover: + how: shell + url: https://gitlab.com/redhat/centos-stream/rpms/python-blivet.git + ref: c10s + dist-git-source: true + dist-git-install-builddeps: true + tests: + - name: upstream test suite + test: | + set -x + if [ -z "$PKG_VER" ]; then + PKG_VER=`rpmspec -q --srpm --qf "%{version}" python-blivet.spec` + fi + if [ -z "$PKG_VER" ]; then + echo "Error: Unable to extract package version" + exit 1 + fi + pushd $TMT_SOURCE_DIR/blivet-${PKG_VER} + + blivet_path=$(find /usr/ -path */site-packages | tr '\n' ':') + PYTHONPATH=$blivet_path python3 tests/run_tests.py + +execute: + - how: tmt diff --git a/python-blivet.spec b/python-blivet.spec index d48903d..d6a7bb4 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -5,7 +5,7 @@ Version: 3.10.0 #%%global prerelease .b2 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 20%{?prerelease}%{?dist}.alma.1 +Release: 21%{?prerelease}%{?dist}.alma.1 Epoch: 1 License: LGPL-2.1-or-later %global realname blivet @@ -35,6 +35,7 @@ Patch15: 0017-LVMPV-format-size-fix.patch Patch16: 0018-Include-additional-information-in-PartitioningError.patch Patch17: 0019-Make-ActionDestroyFormat-optional.patch Patch18: 0020-Wipe-end-partition-before-creating-it-as-well-as-the-start.patch +Patch19: 0021-Tell-LVM-DBus-to-refresh-its-internal-status-during-reset.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -129,9 +130,13 @@ make DESTDIR=%{buildroot} install %{python3_sitelib}/* %changelog -* Wed Jun 11 2025 Neal Gompa - 1:3.10.0-20.alma.1 +* Fri Jul 04 2025 Neal Gompa - 1:3.10.0-21.alma.1 - AlmaLinux changes: Enable Btrfs support +* Tue Jul 01 2025 Vojtech Trefny - 3.10.0-21 +- Tell LVM DBus to refresh it's internal status during reset + Resolves: RHEL-93967 + * Fri May 30 2025 Vojtech Trefny - 3.10.0-20 - Wipe end partition before creating it as well as the start Resolves: RHEL-93967 diff --git a/tests/lvm_factory.py b/tests/lvm_factory.py deleted file mode 100644 index 6603af2..0000000 --- a/tests/lvm_factory.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import sys - -import blivet - - -POOL_NAME = "blivet_test" - -parser = argparse.ArgumentParser() -parser.add_argument('-d', '--disks', default='') -args = parser.parse_args() - -b = blivet.Blivet() -b.reset() - -disks = list() -for disk_id in args.disks.split(','): - disk = b.devicetree.resolve_device(disk_id) - if not disk.is_disk: - sys.stderr.write("specified disk '%s' is not a disk\n" % disk_id) - sys.exit(1) - - disks.append(disk) - b.initialize_disk(disk) - -if len(disks) > 1: - container_raid_level = "raid1" - total_size = min(d.size for d in disks) -else: - container_raid_level = None - total_size = sum(d.size for d in disks) - -lv1 = b.factory_device(size=total_size*0.8, disks=disks, - name="lv1", container_name=POOL_NAME, - fstype='xfs', device_type=blivet.devicefactory.DEVICE_TYPE_LVM) -lv2 = b.factory_device(disks=disks, name="lv2", - container_name=POOL_NAME, container_raid_level='raid1', - fstype='ext4', device_type=blivet.devicefactory.DEVICE_TYPE_LVM) - -b.do_it() diff --git a/tests/provision.fmf b/tests/provision.fmf deleted file mode 100644 index be22d73..0000000 --- a/tests/provision.fmf +++ /dev/null @@ -1,8 +0,0 @@ ---- - -standard-inventory-qcow2: - qemu: - m: 1G - drive: - - size: 10737418240 - - size: 10737418240 diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 4ca1638..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# - hosts: localhost -- hosts: all - roles: - - role: standard-test-source - tags: - - always - - - role: standard-test-basic - tags: - - atomic - - classic - required_packages: - - python3 - - python3-dbus - - libblockdev-plugins-all - - python3-yaml - - targetcli - - stratis-cli - - stratisd - tests: - - unit-tests: - dir: . - run: ./unit_testing.sh - diff --git a/tests/unit_testing.sh b/tests/unit_testing.sh deleted file mode 100644 index e028333..0000000 --- a/tests/unit_testing.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Bail out if anything goes wrong -set -e - -# Get path to blivet -blivet_path=$(find /usr/ -path */site-packages | tr '\n' ':') - -# Run upstream unit tests -cd ./source/ -PYTHONPATH=$blivet_path python3 tests/run_tests.py