mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add hard_limit support to Pure Strage FlashBlade filesystem module (#43987)
This commit is contained in:
parent
ddfd1dbfc6
commit
8a88d78285
1 changed files with 39 additions and 8 deletions
|
@ -78,6 +78,15 @@ options:
|
||||||
required: false
|
required: false
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
hard_limit:
|
||||||
|
description:
|
||||||
|
- Define whether the capacity for a filesystem is a hard limit.
|
||||||
|
- CAUTION This will cause the filesystem to go Read-Only if the
|
||||||
|
capacity has already exceeded the logical size of the filesystem.
|
||||||
|
required: false
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 2.8
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- purestorage.fb
|
- purestorage.fb
|
||||||
'''
|
'''
|
||||||
|
@ -122,6 +131,7 @@ EXAMPLES = '''
|
||||||
nfs_rules: '*(ro)'
|
nfs_rules: '*(ro)'
|
||||||
snapshot: true
|
snapshot: true
|
||||||
fastremove: true
|
fastremove: true
|
||||||
|
hard_limit: true
|
||||||
smb: true
|
smb: true
|
||||||
state: present
|
state: present
|
||||||
fb_url: 10.10.10.2
|
fb_url: 10.10.10.2
|
||||||
|
@ -140,6 +150,9 @@ from ansible.module_utils.basic import AnsibleModule, human_to_bytes
|
||||||
from ansible.module_utils.pure import get_blade, purefb_argument_spec
|
from ansible.module_utils.pure import get_blade, purefb_argument_spec
|
||||||
|
|
||||||
|
|
||||||
|
HARD_LIMIT_API_VERSION = '1.4'
|
||||||
|
|
||||||
|
|
||||||
def get_fs(module, blade):
|
def get_fs(module, blade):
|
||||||
"""Return Filesystem or None"""
|
"""Return Filesystem or None"""
|
||||||
fs = []
|
fs = []
|
||||||
|
@ -161,6 +174,18 @@ def create_fs(module, blade):
|
||||||
|
|
||||||
if not module.check_mode:
|
if not module.check_mode:
|
||||||
try:
|
try:
|
||||||
|
api_version = blade.api_version.list_versions().versions
|
||||||
|
if HARD_LIMIT_API_VERSION in api_version:
|
||||||
|
fs_obj = FileSystem(name=module.params['name'],
|
||||||
|
provisioned=size,
|
||||||
|
fast_remove_directory_enabled=module.params['fastremove'],
|
||||||
|
hard_limit_enabled=module.params['hard_limit'],
|
||||||
|
snapshot_directory_enabled=module.params['snapshot'],
|
||||||
|
nfs=NfsRule(enabled=module.params['nfs'], rules=module.params['nfs_rules']),
|
||||||
|
smb=ProtocolRule(enabled=module.params['smb']),
|
||||||
|
http=ProtocolRule(enabled=module.params['http'])
|
||||||
|
)
|
||||||
|
else:
|
||||||
fs_obj = FileSystem(name=module.params['name'],
|
fs_obj = FileSystem(name=module.params['name'],
|
||||||
provisioned=size,
|
provisioned=size,
|
||||||
fast_remove_directory_enabled=module.params['fastremove'],
|
fast_remove_directory_enabled=module.params['fastremove'],
|
||||||
|
@ -223,6 +248,11 @@ def modify_fs(module, blade):
|
||||||
if not module.params['fastremove'] and fs.fast_remove_directory_enabled:
|
if not module.params['fastremove'] and fs.fast_remove_directory_enabled:
|
||||||
attr['fast_remove_directory_enabled'] = module.params['fastremove']
|
attr['fast_remove_directory_enabled'] = module.params['fastremove']
|
||||||
changed = True
|
changed = True
|
||||||
|
api_version = blade.api_version.list_versions().versions
|
||||||
|
if HARD_LIMIT_API_VERSION in api_version:
|
||||||
|
if not module.params['hard_limit'] and fs.hard_limit_enabled:
|
||||||
|
attr['hard_limit_enabled'] = module.params['hard_limit']
|
||||||
|
changed = True
|
||||||
if changed:
|
if changed:
|
||||||
n_attr = FileSystem(**attr)
|
n_attr = FileSystem(**attr)
|
||||||
try:
|
try:
|
||||||
|
@ -277,6 +307,7 @@ def main():
|
||||||
http=dict(default='false', type='bool'),
|
http=dict(default='false', type='bool'),
|
||||||
snapshot=dict(default='false', type='bool'),
|
snapshot=dict(default='false', type='bool'),
|
||||||
fastremove=dict(default='false', type='bool'),
|
fastremove=dict(default='false', type='bool'),
|
||||||
|
hard_limit=dict(default='false', type='bool'),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
size=dict()
|
size=dict()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue