1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmdbusd: Always leverage udev

Previously we utilized udev until we got a dbus notification from lvm
command line tools.  This however misses the case where something outside
of lvm clears the signatures on a block device and we fail to refresh the
state of the daemon.  Change the behavior so we always monitor udev events,
but ignore those udev events that pertain to lvm members.

Note: --udev command line option no longer does anything and simply
outputs a message that it's no longer used.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1967171
This commit is contained in:
Tony Asleson 2022-10-18 12:30:09 -05:00
parent 5a6ae2d4d8
commit 8a1c73ddbe
3 changed files with 15 additions and 14 deletions

View File

@ -125,7 +125,8 @@ def process_args():
# Add udev watching # Add udev watching
if args.use_udev: if args.use_udev:
# Make sure this msg ends up in the journal, so we know # Make sure this msg ends up in the journal, so we know
log_msg('Utilizing udev to trigger updates') log_msg('The --udev option is no longer supported,'
'the daemon always uses a combination of dbus notify from lvm tools and udev')
return args return args

View File

@ -203,12 +203,6 @@ class Manager(AutomatedProperties):
in_signature='s', out_signature='i') in_signature='s', out_signature='i')
def ExternalEvent(self, command): def ExternalEvent(self, command):
utils.log_debug("ExternalEvent %s" % command) utils.log_debug("ExternalEvent %s" % command)
# If a user didn't explicitly specify udev, we will turn it off now.
if not cfg.args.use_udev:
if udevwatch.remove():
utils.log_msg("ExternalEvent received, disabling "
"udev monitoring")
# We are dependent on external events now to stay current!
r = RequestEntry( r = RequestEntry(
-1, Manager._external_event, (command,), None, None, False) -1, Manager._external_event, (command,), None, None, False)
cfg.worker_q.put(r) cfg.worker_q.put(r)

View File

@ -52,20 +52,26 @@ def filter_event(action, device):
# when appropriate. # when appropriate.
refresh = False refresh = False
# Ignore everything but change
if action != 'change':
return
if 'ID_FS_TYPE' in device: if 'ID_FS_TYPE' in device:
fs_type_new = device['ID_FS_TYPE'] fs_type_new = device['ID_FS_TYPE']
if 'LVM' in fs_type_new: if 'LVM' in fs_type_new:
refresh = True # Let's skip udev events for LVM devices as we should be handling them
# with the dbus notifications.
pass
elif fs_type_new == '': elif fs_type_new == '':
# Check to see if the device was one we knew about # Check to see if the device was one we knew about
if 'DEVNAME' in device: if 'DEVNAME' in device:
found = cfg.om.get_object_by_lvm_id(device['DEVNAME']) if cfg.om.get_object_by_lvm_id(device['DEVNAME']):
if found:
refresh = True refresh = True
else:
if 'DM_LV_NAME' in device: # This handles the wipefs -a path
refresh = True if not refresh and 'DEVNAME' in device:
if cfg.om.get_object_by_lvm_id(device['DEVNAME']):
refresh = True
if refresh: if refresh:
udev_add() udev_add()