-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from pcahyna/el7-ext4-whole-disk-rebased
Pass -F to mke2fs for whole disks in RHEL
- Loading branch information
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,10 @@ | |
description: | ||
- boolean indicating that we should fail rather than implicitly/automatically | ||
removing devices or formatting | ||
diskvolume_mkfs_option_map: | ||
description: | ||
- dict which maps filesystem names to additional mkfs options that should be used | ||
when creating a disk volume (that is, a whole disk filesystem) | ||
author: | ||
- David Lehman ([email protected]) | ||
|
@@ -450,6 +454,19 @@ def _get_device_id(self): | |
def _type_check(self): | ||
return self._device.raw_device.is_disk | ||
|
||
def _get_format(self): | ||
fmt = super(BlivetDiskVolume, self)._get_format() | ||
# pass -F to mke2fs on whole disks in RHEL7 | ||
mkfs_options = diskvolume_mkfs_option_map.get(self._volume['fs_type']) | ||
if mkfs_options: | ||
if fmt.create_options: | ||
fmt.create_options += " " | ||
else: | ||
fmt.create_options = "" | ||
fmt.create_options += mkfs_options | ||
|
||
return fmt | ||
|
||
def _create(self): | ||
self._reformat() | ||
|
||
|
@@ -1111,7 +1128,8 @@ def run_module(): | |
packages_only=dict(type='bool', required=False, default=False), | ||
disklabel_type=dict(type='str', required=False, default=None), | ||
safe_mode=dict(type='bool', required=False, default=True), | ||
use_partitions=dict(type='bool', required=False, default=True)) | ||
use_partitions=dict(type='bool', required=False, default=True), | ||
diskvolume_mkfs_option_map=dict(type='dict', required=False, default={})) | ||
|
||
# seed the result dict in the object | ||
result = dict( | ||
|
@@ -1147,6 +1165,9 @@ def run_module(): | |
global safe_mode | ||
safe_mode = module.params['safe_mode'] | ||
|
||
global diskvolume_mkfs_option_map | ||
diskvolume_mkfs_option_map = module.params['diskvolume_mkfs_option_map'] | ||
|
||
b = Blivet() | ||
b.reset() | ||
fstab = FSTab(b) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters