diff options
author | Andy Piper <andy.piper@arcticwolf.com> | 2021-11-21 15:11:56 -0500 |
---|---|---|
committer | Andy Piper <andy.piper@arcticwolf.com> | 2021-11-22 10:26:17 -0500 |
commit | 2a641739075e9907f5c87f705cf7121ab50d339b (patch) | |
tree | fb58d8b161702fd1fd55ff21c92315f633d8c225 | |
parent | 7c373bde01651624cfc6cf2bd1a62f0841d7006c (diff) | |
download | vmdb2-2a641739075e9907f5c87f705cf7121ab50d339b.tar.gz |
lvcreate_plugin: add ability to fill available space
The special size value "fill" will instruct the lvcreate_plugin to
create a partition that uses all of the available space in the specified
logical volume
-rw-r--r-- | vmdb/plugins/lvcreate.mdwn | 3 | ||||
-rw-r--r-- | vmdb/plugins/lvcreate_plugin.py | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/vmdb/plugins/lvcreate.mdwn b/vmdb/plugins/lvcreate.mdwn index fcb350d..e1aca3a 100644 --- a/vmdb/plugins/lvcreate.mdwn +++ b/vmdb/plugins/lvcreate.mdwn @@ -9,7 +9,8 @@ Step keys: * `name` — REQUIRED; tag for the new LV block device. -* `size` — REQUIRED; size of the new LV. +* `size` — REQUIRED; size of the new LV. The special value `fill` will + make the volume use all of the available space. Example (in the .vmdb file): diff --git a/vmdb/plugins/lvcreate_plugin.py b/vmdb/plugins/lvcreate_plugin.py index 5e65b66..5af3926 100644 --- a/vmdb/plugins/lvcreate_plugin.py +++ b/vmdb/plugins/lvcreate_plugin.py @@ -35,7 +35,10 @@ class LvcreateStepRunner(vmdb.StepRunnerInterface): lvname = values["name"] size = values["size"] - vmdb.runcmd(["lvcreate", "-qq", "--name", lvname, "--size", size, vgname]) + if size.lower() == "fill": + vmdb.runcmd(["lvcreate", "-qq", "--name", lvname, "--extents", "100%FREE", vgname]) + else: + vmdb.runcmd(["lvcreate", "-qq", "--name", lvname, "--size", size, vgname]) lvdev = "/dev/{}/{}".format(vgname, lvname) assert os.path.exists(lvdev) |