11__author__ = 'desultory'
2- __version__ = '4.17.0 '
2+ __version__ = '4.17.1 '
33
44from pathlib import Path
55from 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