Skip to content

Commit d44558d

Browse files
committed
Tell LVM DBus to refresh it's internal status during reset
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.
1 parent 086797a commit d44558d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

blivet/devicelibs/lvm.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
log = logging.getLogger("blivet")
3737

3838
from . import raid
39+
from .. import safe_dbus
3940
from ..size import Size
4041
from ..i18n import N_
4142
from ..flags import flags
@@ -338,3 +339,21 @@ def reenable_lvm_autoactivation(lvmconf=LVM_LOCAL_CONF):
338339

339340
global AUTO_ACTIVATION
340341
AUTO_ACTIVATION = False
342+
343+
344+
def lvm_dbusd_refresh():
345+
lvm_soname = blockdev.get_plugin_soname(blockdev.Plugin.LVM)
346+
if 'dbus' not in lvm_soname:
347+
return
348+
349+
try:
350+
rc = safe_dbus.call_sync("com.redhat.lvmdbus1",
351+
"/com/redhat/lvmdbus1/Manager",
352+
"com.redhat.lvmdbus1.Manager",
353+
"Refresh",
354+
None)
355+
except safe_dbus.DBusCallError as e:
356+
log.error("Exception occurred when calling LVM DBusD refresh: %s", str(e))
357+
else:
358+
if rc[0] != 0:
359+
log.error("Failed to call LVM DBusD refresh: %s", rc)

blivet/devicetree.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def reset(self, ignored_disks=None, exclusive_disks=None):
102102

103103
lvm.lvm_devices_reset()
104104

105+
# force LVM DBusD to refresh its internal state
106+
lvm.lvm_dbusd_refresh()
107+
105108
self.exclusive_disks = exclusive_disks or []
106109
self.ignored_disks = ignored_disks or []
107110

0 commit comments

Comments
 (0)