mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
[PR #9698/1beee879 backport][stable-10] lvg: Add parameter to disable removal of extra physical volumes (#9717)
lvg: Add parameter to disable removal of extra physical volumes (#9698)
* Add parameter to disable removal of extra physical volumes
Signed-off-by: Massl123 <Massl123@users.noreply.github.com>
* Set PR number in changelog fragment
Signed-off-by: Massl123 <Massl123@users.noreply.github.com>
* Fix tests
Signed-off-by: Massl123 <Massl123@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add comment in pvs
Signed-off-by: Massl123 <Massl123@users.noreply.github.com>
---------
Signed-off-by: Massl123 <Massl123@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1beee87961
)
Co-authored-by: Marcel Freundl <Massl123@users.noreply.github.com>
This commit is contained in:
parent
cb46453b78
commit
da3ba1e7be
4 changed files with 56 additions and 0 deletions
|
@ -34,6 +34,7 @@ options:
|
|||
- List of comma-separated devices to use as physical devices in this volume group.
|
||||
- Required when creating or resizing volume group.
|
||||
- The module will take care of running pvcreate if needed.
|
||||
- O(remove_extra_pvs) controls whether or not unspecified physical devices are removed from the volume group.
|
||||
type: list
|
||||
elements: str
|
||||
pesize:
|
||||
|
@ -88,6 +89,12 @@ options:
|
|||
type: bool
|
||||
default: false
|
||||
version_added: 7.1.0
|
||||
remove_extra_pvs:
|
||||
description:
|
||||
- Remove physical volumes from the volume group which are not in O(pvs).
|
||||
type: bool
|
||||
default: true
|
||||
version_added: 10.4.0
|
||||
seealso:
|
||||
- module: community.general.filesystem
|
||||
- module: community.general.lvol
|
||||
|
@ -383,6 +390,7 @@ def main():
|
|||
force=dict(type='bool', default=False),
|
||||
reset_vg_uuid=dict(type='bool', default=False),
|
||||
reset_pv_uuid=dict(type='bool', default=False),
|
||||
remove_extra_pvs=dict(type="bool", default=True),
|
||||
),
|
||||
required_if=[
|
||||
['reset_pv_uuid', True, ['pvs']],
|
||||
|
@ -399,6 +407,7 @@ def main():
|
|||
vgoptions = module.params['vg_options'].split()
|
||||
reset_vg_uuid = module.boolean(module.params['reset_vg_uuid'])
|
||||
reset_pv_uuid = module.boolean(module.params['reset_pv_uuid'])
|
||||
remove_extra_pvs = module.boolean(module.params["remove_extra_pvs"])
|
||||
|
||||
this_vg = find_vg(module=module, vg=vg)
|
||||
present_state = state in ['present', 'active', 'inactive']
|
||||
|
@ -494,6 +503,9 @@ def main():
|
|||
devs_to_remove = list(set(current_devs) - set(dev_list))
|
||||
devs_to_add = list(set(dev_list) - set(current_devs))
|
||||
|
||||
if not remove_extra_pvs:
|
||||
devs_to_remove = []
|
||||
|
||||
if current_devs:
|
||||
if present_state:
|
||||
for device in current_devs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue