From 474cd53826fda5a571cca8b5dda7cf949291dd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Schl=C3=BCter?= Date: Mon, 16 Jul 2018 13:20:39 +0200 Subject: Add support for filesystem labels --- smoke-pc.vmdb | 1 + vmdb/plugins/mkfs_plugin.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/smoke-pc.vmdb b/smoke-pc.vmdb index 6773b6a..7d47463 100644 --- a/smoke-pc.vmdb +++ b/smoke-pc.vmdb @@ -13,6 +13,7 @@ steps: - mkfs: ext4 partition: root-part + label: smoke - mount: root-part fs-tag: root-fs diff --git a/vmdb/plugins/mkfs_plugin.py b/vmdb/plugins/mkfs_plugin.py index 5aca499..e34c027 100644 --- a/vmdb/plugins/mkfs_plugin.py +++ b/vmdb/plugins/mkfs_plugin.py @@ -39,4 +39,12 @@ class MkfsStepRunner(vmdb.StepRunnerInterface): device = state.parts[part_tag] vmdb.progress( 'Creating {} filesystem on {}'.format(fstype, device)) - vmdb.runcmd(['/sbin/mkfs', '-t', fstype, device]) + cmd = ['/sbin/mkfs', '-t', fstype] + if 'label' in step: + if fstype == 'vfat': + cmd.append('-n') + else: + cmd.append('-L') + cmd.append(step['label']) + cmd.append(device) + vmdb.runcmd(cmd) -- cgit v1.2.1