11__author__ = 'desultory'
2- __version__ = '4.16.4 '
2+ __version__ = '4.16.5 '
33
44from pathlib import Path
55from zenlib .util import contains , pretty_print
@@ -375,6 +375,9 @@ def _autodetect_dm(self, mountpoint, device=None) -> None:
375375 autodetect_luks (self , source_device , dev_name , dm_info )
376376 elif dm_info .get ('type' ) == 'LVM2_member' :
377377 autodetect_lvm (self , source_device , dev_name , dm_info )
378+ elif dm_info .get ('type' ) == 'linux_raid_member' :
379+ autodetect_raid (self , source_device , dev_name , dm_info )
380+ raise NotImplementedError ("RAID autodetection not implemented." )
378381 else :
379382 raise RuntimeError ("Unknown device mapper device type: %s" % dm_info .get ('type' ))
380383
@@ -388,6 +391,15 @@ def _autodetect_dm(self, mountpoint, device=None) -> None:
388391 self .logger .debug ("Slave does not appear to be a DM device: %s" % slave )
389392
390393
394+ @contains ('autodetect_root_raid' , "Skipping RAID autodetection, autodetect_root_raid is disabled." , log_level = 30 )
395+ @contains ('hostonly' , "Skipping RAID autodetection, hostonly mode is disabled." , log_level = 30 )
396+ def autodetect_raid (self , mount_loc , dm_num , dm_info ) -> None :
397+ """ Autodetects MD RAID mounts and sets the raid config. """
398+ if 'ugrd.fs.raid' not in self ['modules' ]:
399+ self .logger .info ("Autodetected MDRAID mount, enabling the mdraid module." )
400+ self ['modules' ] = 'ugrd.fs.mdraid'
401+
402+
391403@contains ('autodetect_root_dm' , "Skipping device mapper autodetection, autodetect_root_dm is disabled." , log_level = 30 )
392404@contains ('hostonly' , "Skipping device mapper autodetection, hostonly mode is disabled." , log_level = 30 )
393405def autodetect_root_dm (self ) -> None :
0 commit comments