diff --git a/changelogs/fragments/2935-lvol-support_check_mode_thinpool.yml b/changelogs/fragments/2935-lvol-support_check_mode_thinpool.yml new file mode 100644 index 0000000000..3efbe59860 --- /dev/null +++ b/changelogs/fragments/2935-lvol-support_check_mode_thinpool.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - lvol - honor ``check_mode`` on thinpool (https://github.com/ansible-collections/community.general/issues/2934). diff --git a/plugins/modules/system/lvol.py b/plugins/modules/system/lvol.py index fafa7db38a..e8b0ab838b 100644 --- a/plugins/modules/system/lvol.py +++ b/plugins/modules/system/lvol.py @@ -471,9 +471,9 @@ def main(): if size_opt == 'l': module.fail_json(changed=False, msg="Thin volume sizing with percentage not supported.") size_opt = 'V' - cmd = "%s %s -n %s -%s %s%s %s -T %s/%s" % (lvcreate_cmd, yesopt, lv, size_opt, size, size_unit, opts, vg, thinpool) + cmd = "%s %s %s -n %s -%s %s%s %s -T %s/%s" % (lvcreate_cmd, test_opt, yesopt, lv, size_opt, size, size_unit, opts, vg, thinpool) elif thinpool and not lv: - cmd = "%s %s -%s %s%s %s -T %s/%s" % (lvcreate_cmd, yesopt, size_opt, size, size_unit, opts, vg, thinpool) + cmd = "%s %s %s -%s %s%s %s -T %s/%s" % (lvcreate_cmd, test_opt, yesopt, size_opt, size, size_unit, opts, vg, thinpool) else: cmd = "%s %s %s -n %s -%s %s%s %s %s %s" % (lvcreate_cmd, test_opt, yesopt, lv, size_opt, size, size_unit, opts, vg, pvs) rc, dummy, err = module.run_command(cmd)