Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdo: add force option #2110

Merged
merged 6 commits into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/2110-vdo-add_force_option.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- vdo - add ``force`` option (https://github.com/ansible-collections/community.general/issues/2101).
15 changes: 14 additions & 1 deletion plugins/modules/system/vdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@
configured setting unless a different value is specified
in the playbook.
type: str
force:
description:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've taken the description from man page in
https://github.com/dm-vdo/vdo/blob/827e5e0974c62a4e169766020fb69b3f34015851/vdo-manager/man/vdo.8#L580-L584
Please change it in any way you see fit.

- When creating a volume, ignores any existing file system
or VDO signature already present in the storage device.
When stopping or removing a VDO volume, first unmounts
the file system stored on the device if mounted.
felixfontein marked this conversation as resolved.
Show resolved Hide resolved
type: bool
default: no
version_added: 2.4.0
notes:
- In general, the default thread configuration should be used.
requirements:
Expand Down Expand Up @@ -409,6 +418,9 @@ def add_vdooptions(params):
if ('indexmode' in params) and (params['indexmode'] == 'sparse'):
options.append("--sparseIndex=enabled")

if ('force' in params) and (params['force']):
options.append("--force")

# Entering an invalid thread config results in a cryptic
# 'Could not set up device mapper for %s' error from the 'vdo'
# command execution. The dmsetup module on the system will
Expand Down Expand Up @@ -465,7 +477,8 @@ def run_module():
biothreads=dict(type='str'),
cputhreads=dict(type='str'),
logicalthreads=dict(type='str'),
physicalthreads=dict(type='str')
physicalthreads=dict(type='str'),
force=dict(type='bool', default=False)
aminvakil marked this conversation as resolved.
Show resolved Hide resolved
)

# Seed the result dictionary in the object. There will be an
Expand Down