Skip to content

Conversation

vojtechtrefny
Copy link
Member

@vojtechtrefny vojtechtrefny commented Jun 30, 2025

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

Summary by Sourcery

Trigger a D-Bus refresh on the LVM daemon during device population to ensure its internal state reflects external changes

Bug Fixes:

  • Force LVM DBusD to refresh its internal state on reset to avoid stale volume entries after using external disk tools

Enhancements:

  • Introduce lvm_dbusd_refresh helper to invoke the com.redhat.lvmdbus1.Manager.Refresh method via D-Bus
  • Invoke the new refresh helper in the populator after volume info updates

Unfortunately some users run wipefs <disk> 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
Copy link

sourcery-ai bot commented Jun 30, 2025

Reviewer's Guide

The PR adds a new helper to trigger an LVM DBus daemon refresh and integrates it into the reset/population flow to ensure stale LVM metadata is cleared when underlying disks are wiped without udev events.

Sequence diagram for LVM DBusD refresh during reset

sequenceDiagram
    participant Populator
    participant LVM
    participant blockdev
    participant safe_dbus
    participant LVM_DBusD
    participant log

    Populator->>LVM: lvm_dbusd_refresh()
    LVM->>blockdev: get_plugin_soname(LVM)
    blockdev-->>LVM: lvm_soname
    alt lvm_soname contains 'dbus'
        LVM->>safe_dbus: call_sync(Refresh)
        safe_dbus->>LVM_DBusD: Refresh
        LVM_DBusD-->>safe_dbus: rc
        safe_dbus-->>LVM: rc
        alt rc[0] != 0
            LVM->>log: error("Failed to call LVM DBusD refresh: %s", rc)
        end
    else lvm_soname does not contain 'dbus'
        LVM-->>Populator: return
    end
Loading

Class diagram for new lvm_dbusd_refresh helper

classDiagram
    class lvm {
        +lvm_dbusd_refresh()
    }
    class blockdev {
        +get_plugin_soname(plugin)
    }
    class safe_dbus {
        +call_sync(service, path, interface, method, args)
        class DBusCallError
    }
    class log {
        +error(msg, ...)
    }
    lvm --> blockdev : uses
    lvm --> safe_dbus : uses
    lvm --> log : logs errors
Loading

File-Level Changes

Change Details Files
Add lvm_dbusd_refresh() helper to trigger LVM DBus daemon state refresh
  • Determine if the LVM plugin uses DBus before proceeding
  • Call com.redhat.lvmdbus1.Manager.Refresh via safe_dbus.call_sync
  • Log errors on DBus call failures or non-zero return codes
blivet/devicelibs/lvm.py
Invoke the DBus refresh helper during device info reset
  • Insert comment explaining the forced DBus refresh
  • Call lvm.lvm_dbusd_refresh() after dropping device info cache
blivet/populator/populator.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@vojtechtrefny
Copy link
Member Author

/packit test

@vojtechtrefny vojtechtrefny merged commit d9b436e into storaged-project:rhel10-branch Jul 3, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant