Skip to content

Commit ae8fb23

Browse files
committed
improve docs, simplify source detection
Signed-off-by: Zen <[email protected]>
1 parent d87879a commit ae8fb23

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ugrd/fs/mounts.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,11 @@ def _get_device_id(device: str) -> str:
311311
def _autodetect_dm(self, mountpoint, device=None) -> None:
312312
"""
313313
Autodetects device mapper config given a mountpoint.
314-
Uses the passed device if the mountpoint is not found in self['_mounts'], and is passed.
315-
Ensures it's a device mapper mount, then autodetects the mount type.
314+
Uses the mountpouint from self['_mounts'], raises an error if not found.
315+
Uses the device path if passed.
316+
Attempts to get the device info from blkid based on the device path.
316317
318+
Ensures it's a device mapper mount, then autodetects the mount type.
317319
Adds kmods to the autodetect list based on the mount source.
318320
"""
319321
if device:
@@ -377,9 +379,8 @@ def _autodetect_dm(self, mountpoint, device=None) -> None:
377379
autodetect_mount_kmods(self, slave_source)
378380

379381
for slave in self._dm_info[dev_name]['slaves']:
380-
self.logger.warning(slave)
381382
try:
382-
_autodetect_dm(self, mountpoint, f"/dev/{slave}")
383+
_autodetect_dm(self, mountpoint, slave) # Just pass the slave device name, as it will be re-detected
383384
self.logger.info("[%s] Autodetected device mapper container: %s" % (source_device.name, slave))
384385
except KeyError:
385386
self.logger.debug("Slave does not appear to be a DM device: %s" % slave)

0 commit comments

Comments
 (0)