|
35 | 35 | description: |
36 | 36 | - boolean indicating that we should fail rather than implicitly/automatically |
37 | 37 | removing devices or formatting |
| 38 | + diskvolume_mkfs_option_map: |
| 39 | + description: |
| 40 | + - dict which maps filesystem names to additional mkfs options that should be used |
| 41 | + when creating a disk volume (that is, a whole disk filesystem) |
38 | 42 |
|
39 | 43 | author: |
40 | 44 | - David Lehman ([email protected]) |
@@ -450,6 +454,19 @@ def _get_device_id(self): |
450 | 454 | def _type_check(self): |
451 | 455 | return self._device.raw_device.is_disk |
452 | 456 |
|
| 457 | + def _get_format(self): |
| 458 | + fmt = super(BlivetDiskVolume, self)._get_format() |
| 459 | + # pass -F to mke2fs on whole disks in RHEL7 |
| 460 | + mkfs_options = diskvolume_mkfs_option_map.get(self._volume['fs_type']) |
| 461 | + if mkfs_options: |
| 462 | + if fmt.create_options: |
| 463 | + fmt.create_options += " " |
| 464 | + else: |
| 465 | + fmt.create_options = "" |
| 466 | + fmt.create_options += mkfs_options |
| 467 | + |
| 468 | + return fmt |
| 469 | + |
453 | 470 | def _create(self): |
454 | 471 | self._reformat() |
455 | 472 |
|
@@ -1111,7 +1128,8 @@ def run_module(): |
1111 | 1128 | packages_only=dict(type='bool', required=False, default=False), |
1112 | 1129 | disklabel_type=dict(type='str', required=False, default=None), |
1113 | 1130 | safe_mode=dict(type='bool', required=False, default=True), |
1114 | | - use_partitions=dict(type='bool', required=False, default=True)) |
| 1131 | + use_partitions=dict(type='bool', required=False, default=True), |
| 1132 | + diskvolume_mkfs_option_map=dict(type='dict', required=False, default={})) |
1115 | 1133 |
|
1116 | 1134 | # seed the result dict in the object |
1117 | 1135 | result = dict( |
@@ -1147,6 +1165,9 @@ def run_module(): |
1147 | 1165 | global safe_mode |
1148 | 1166 | safe_mode = module.params['safe_mode'] |
1149 | 1167 |
|
| 1168 | + global diskvolume_mkfs_option_map |
| 1169 | + diskvolume_mkfs_option_map = module.params['diskvolume_mkfs_option_map'] |
| 1170 | + |
1150 | 1171 | b = Blivet() |
1151 | 1172 | b.reset() |
1152 | 1173 | fstab = FSTab(b) |
|
0 commit comments