Skip to content

Commit 831be1c

Browse files
committed
autodetect dm containers on all types
Signed-off-by: Zen <[email protected]>
1 parent 5983092 commit 831be1c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/ugrd/fs/mounts.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '4.14.3'
2+
__version__ = '4.15.0'
33

44
from pathlib import Path
55
from zenlib.util import contains, pretty_print
@@ -298,8 +298,10 @@ def _get_device_id(device: str) -> str:
298298
@contains('hostonly', "Skipping device mapper autodetection, hostonly mode is disabled.", log_level=30)
299299
def _autodetect_dm(self, mountpoint) -> None:
300300
"""
301-
Autodetects device mapper config given a device.
302-
If no device is passed, it will attempt to autodetect based on the mountpoint.
301+
Autodetects device mapper config given a mountpoint.
302+
Ensures it's a device mapper mount, then autodetects the mount type.
303+
304+
Adds kmods to the autodetect list based on the mount source.
303305
"""
304306
if mountpoint in self['_mounts']:
305307
source_device = self['_mounts'][mountpoint]['device']
@@ -349,6 +351,12 @@ def _autodetect_dm(self, mountpoint) -> None:
349351

350352
autodetect_mount_kmods(self, slave_source)
351353

354+
for slave in self._dm_info[dm_num]['slaves']:
355+
try:
356+
_autodetect_dm(self, '/dev/' + slave)
357+
except KeyError:
358+
self.logger.debug("Slave does not appear to be a DM device: %s" % slave)
359+
352360

353361
@contains('autodetect_root_dm', "Skipping device mapper autodetection, autodetect_root_dm is disabled.", log_level=30)
354362
@contains('hostonly', "Skipping device mapper autodetection, hostonly mode is disabled.", log_level=30)
@@ -370,13 +378,6 @@ def autodetect_root_lvm(self, mount_loc, dm_num, dm_info) -> None:
370378
else:
371379
raise ValueError("Failed to autodetect LVM volume uuid: %s" % mount_loc.name)
372380

373-
# Check if the LVM volume is part of a LUKS volume
374-
for slave in self._dm_info[dm_num]['slaves']:
375-
try:
376-
_autodetect_dm(self, '/dev/' + slave)
377-
except KeyError:
378-
self.logger.debug("LVM slave does not appear to be a DM device: %s" % slave)
379-
380381

381382
@contains('autodetect_root_luks', "Skipping LUKS autodetection, autodetect_root_luks is disabled.", log_level=30)
382383
@contains('hostonly', "Skipping LUKS autodetection, hostonly mode is disabled.", log_level=30)

0 commit comments

Comments
 (0)