diff options
author | Matthias Klein <matthias.klein@linux.com> | 2021-02-06 14:46:04 +0100 |
---|---|---|
committer | Matthias Klein <matthias.klein@linux.com> | 2021-02-06 14:46:04 +0100 |
commit | d55167ad0680740b5c0552a1824a9781583bb21b (patch) | |
tree | b8a34f298b548711d01d995f2645e0d235706047 | |
parent | 1a5c99236ca95228643fa840216820437b2c0c1c (diff) | |
download | vmdb2-d55167ad0680740b5c0552a1824a9781583bb21b.tar.gz |
Add support for mkfs options
Signed-off-by: Matthias Klein <matthias.klein@linux.com>
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | vmdb/plugins/mkfs.mdwn | 3 | ||||
-rw-r--r-- | vmdb/plugins/mkfs_plugin.py | 8 |
3 files changed, 12 insertions, 1 deletions
@@ -4,6 +4,8 @@ NEWS for vmdb2, the Debian disk image builder Version 0.22+git, not yet released ----------------------------------------------------------------------------- +* Matthias Klein added the optional `options` field to the `mkfs` + step to set aditional options for mkfs. Version 0.22, released 2021-01-16 ----------------------------------------------------------------------------- diff --git a/vmdb/plugins/mkfs.mdwn b/vmdb/plugins/mkfs.mdwn index fed8609..7c24f43 100644 --- a/vmdb/plugins/mkfs.mdwn +++ b/vmdb/plugins/mkfs.mdwn @@ -9,7 +9,10 @@ Step keys: * `partition` — REQUIRED; tag for the block device to use. +* `options` — OPTIONAL; aditional options for mkfs. + Example (in the .vmdb file): - mkfs: ext4 partition: root + options: -O ^64bit,^metadata_csum diff --git a/vmdb/plugins/mkfs_plugin.py b/vmdb/plugins/mkfs_plugin.py index e204fa6..83c6aff 100644 --- a/vmdb/plugins/mkfs_plugin.py +++ b/vmdb/plugins/mkfs_plugin.py @@ -26,7 +26,7 @@ class MkfsPlugin(vmdb.Plugin): class MkfsStepRunner(vmdb.StepRunnerInterface): def get_key_spec(self): - return {"mkfs": str, "partition": str, "label": ""} + return {"mkfs": str, "partition": str, "label": "", "options": ""} def run(self, values, settings, state): fstype = values["mkfs"] @@ -50,6 +50,12 @@ class MkfsStepRunner(vmdb.StepRunnerInterface): else: cmd.append("-L") cmd.append(label) + + options = values["options"] or None + if options: + for opt in options.split(' '): + cmd.append(opt) + cmd.append(device) vmdb.runcmd(cmd) |