|
1 | 1 | __author__ = 'desultory' |
2 | | -__version__ = '4.16.5' |
| 2 | +__version__ = '4.16.6' |
3 | 3 |
|
4 | 4 | from pathlib import Path |
5 | 5 | from zenlib.util import contains, pretty_print |
@@ -286,6 +286,7 @@ def get_virtual_block_info(self) -> dict: |
286 | 286 | self['_dm_info'][virt_device.name]['uuid'] = (virt_device / 'dm/uuid').read_text().strip() |
287 | 287 | elif (virt_device / 'md').exists(): |
288 | 288 | self['_dm_info'][virt_device.name]['uuid'] = (virt_device / 'md/uuid').read_text().strip() |
| 289 | + self['_dm_info'][virt_device.name]['level'] = (virt_device / 'md/level').read_text().strip() |
289 | 290 | else: |
290 | 291 | raise ValueError("Failed to get virtual device name: %s" % virt_device.name) |
291 | 292 |
|
@@ -394,11 +395,16 @@ def _autodetect_dm(self, mountpoint, device=None) -> None: |
394 | 395 | @contains('autodetect_root_raid', "Skipping RAID autodetection, autodetect_root_raid is disabled.", log_level=30) |
395 | 396 | @contains('hostonly', "Skipping RAID autodetection, hostonly mode is disabled.", log_level=30) |
396 | 397 | def autodetect_raid(self, mount_loc, dm_num, dm_info) -> None: |
397 | | - """ Autodetects MD RAID mounts and sets the raid config. """ |
| 398 | + """ |
| 399 | + Autodetects MD RAID mounts and sets the raid config. |
| 400 | + Adds kmods for the raid level to the autodetect list. |
| 401 | + """ |
398 | 402 | if 'ugrd.fs.raid' not in self['modules']: |
399 | 403 | self.logger.info("Autodetected MDRAID mount, enabling the mdraid module.") |
400 | 404 | self['modules'] = 'ugrd.fs.mdraid' |
401 | 405 |
|
| 406 | + self['_kmod_auto'] = dm_info['level'] |
| 407 | + |
402 | 408 |
|
403 | 409 | @contains('autodetect_root_dm', "Skipping device mapper autodetection, autodetect_root_dm is disabled.", log_level=30) |
404 | 410 | @contains('hostonly', "Skipping device mapper autodetection, hostonly mode is disabled.", log_level=30) |
@@ -666,6 +672,8 @@ def resolve_blkdev_kmod(self, device) -> list[str]: |
666 | 672 | return ['mmc_block'] |
667 | 673 | elif device_name.startswith('sr'): |
668 | 674 | return ['sr_mod'] |
| 675 | + elif device_name.startswith('md'): |
| 676 | + return ['md_mod'] |
669 | 677 | else: |
670 | 678 | self.logger.error("[%s] Unable to determine kernel module for block device: %s" % (device_name, device)) |
671 | 679 | return [] |
0 commit comments