diff --git a/changelogs/fragments/3681-lvol-fix-create.yml b/changelogs/fragments/3681-lvol-fix-create.yml new file mode 100644 index 0000000000..d04ec5460b --- /dev/null +++ b/changelogs/fragments/3681-lvol-fix-create.yml @@ -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). diff --git a/plugins/modules/system/lvol.py b/plugins/modules/system/lvol.py index e8b0ab838b..b1b9dcb739 100644 --- a/plugins/modules/system/lvol.py +++ b/plugins/modules/system/lvol.py @@ -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: