1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Rework safety check on size arguments for when LV doesn't exist (#3681)

* Rework safety check on size arguments for when LV doesn't exist

* Update changelogs/fragments/3681-lvol-fix-create.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Jake Reynolds <jake.reynolds@bidfx.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
jake2184 2021-11-13 13:00:32 +00:00 committed by GitHub
parent 6f47ddc29f
commit 352047314b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- lvol - allows logical volumes to be created with certain size arguments prefixed with ``+`` to preserve behavior of older versions of this module (https://github.com/ansible-collections/community.general/issues/3665).

View file

@ -451,7 +451,8 @@ def main():
if this_lv is None:
if state == 'present':
if size_operator is not None:
module.fail_json(msg="Bad size specification of '%s%s' for creating LV" % (size_operator, size))
if size_operator == "-" or (size_whole not in ["VG", "PVS", "FREE", "ORIGIN", None]):
module.fail_json(msg="Bad size specification of '%s%s' for creating LV" % (size_operator, size))
# Require size argument except for snapshot of thin volumes
if (lv or thinpool) and not size:
for test_lv in lvs: