Skip to content

Commit 572e5e0

Browse files
committed
improve logging
Signed-off-by: Zen <[email protected]>
1 parent 479dab6 commit 572e5e0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ugrd/fs/mounts.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = 'desultory'
2-
__version__ = '4.17.0'
2+
__version__ = '4.17.1'
33

44
from pathlib import Path
55
from zenlib.util import contains, pretty_print
@@ -393,7 +393,7 @@ def _autodetect_dm(self, mountpoint, device=None) -> None:
393393

394394
@contains('autodetect_root_raid', "Skipping RAID autodetection, autodetect_root_raid is disabled.", log_level=30)
395395
@contains('hostonly', "Skipping RAID autodetection, hostonly mode is disabled.", log_level=30)
396-
def autodetect_raid(self, mount_loc, dm_num, dm_info) -> None:
396+
def autodetect_raid(self, mount_loc, dm_name, dm_info) -> None:
397397
"""
398398
Autodetects MD RAID mounts and sets the raid config.
399399
Adds kmods for the raid level to the autodetect list.
@@ -402,7 +402,11 @@ def autodetect_raid(self, mount_loc, dm_num, dm_info) -> None:
402402
self.logger.info("Autodetected MDRAID mount, enabling the mdraid module.")
403403
self['modules'] = 'ugrd.fs.mdraid'
404404

405-
self['_kmod_auto'] = dm_info['level']
405+
if level := dm_info.get('level'):
406+
self.logger.info("[%s] MDRAID level: %s" % (mount_loc.name, level))
407+
self['_kmod_auto'] = level
408+
else:
409+
raise ValueError("[%s] Failed to autodetect MDRAID level: %s" % (dm_name, dm_info))
406410

407411

408412
@contains('autodetect_root_dm', "Skipping device mapper autodetection, autodetect_root_dm is disabled.", log_level=30)

0 commit comments

Comments
 (0)