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

[Module][1717]new_module_zfs_resize #1767

Open
wants to merge 166 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
3fb4313
Remove Hardcoded hlq
AndreMarcel99 Aug 13, 2024
ccff1e4
Fix removal
AndreMarcel99 Aug 13, 2024
4f6b373
Add some solution
AndreMarcel99 Aug 14, 2024
6196bfc
First version module
AndreMarcel99 Oct 22, 2024
6fc41a9
Get size correctly
AndreMarcel99 Oct 22, 2024
5f6cf47
Refactor module and add new module_utils
AndreMarcel99 Oct 23, 2024
dfdf365
Add comments
AndreMarcel99 Oct 23, 2024
b8419e9
Fix documentation
AndreMarcel99 Oct 23, 2024
66aeda3
Less code, working with verbose
AndreMarcel99 Oct 25, 2024
21f0e18
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Oct 28, 2024
4de7ecb
Fix comments
AndreMarcel99 Oct 29, 2024
17340a1
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Oct 30, 2024
bf2de90
Fix comments and verbose
AndreMarcel99 Oct 30, 2024
33d4c20
Fix comments
AndreMarcel99 Oct 30, 2024
6768c7d
Fix documentation
AndreMarcel99 Oct 30, 2024
ae27c9b
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Nov 5, 2024
7fc4db7
Fix trc and cyl
AndreMarcel99 Nov 6, 2024
6633968
Generate file
AndreMarcel99 Nov 11, 2024
ed76588
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Nov 19, 2024
7a25660
Fix names and operations
AndreMarcel99 Nov 19, 2024
7af7546
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
6ac622d
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
68c5d7f
hange to space_type
AndreMarcel99 Nov 19, 2024
1d96e32
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
646743d
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
e3a1e5d
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
575b7e3
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Nov 19, 2024
7e72ac5
Change names
AndreMarcel99 Nov 19, 2024
c4f7712
Add comments
AndreMarcel99 Nov 20, 2024
da4da68
Return size of space_type given by the user
AndreMarcel99 Nov 20, 2024
41bc999
Add obj as name
AndreMarcel99 Nov 20, 2024
4158d40
Add first two basic test cases
AndreMarcel99 Nov 20, 2024
88287a2
Fix documentation
AndreMarcel99 Nov 25, 2024
6654573
Fix documentation
AndreMarcel99 Nov 25, 2024
67c9136
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Nov 25, 2024
f752b40
Fix documentation
AndreMarcel99 Nov 25, 2024
465a412
Fix documentation
AndreMarcel99 Nov 25, 2024
a52e51b
Fix comments and add trace_path
AndreMarcel99 Nov 25, 2024
c50f474
Fix verbose
AndreMarcel99 Nov 26, 2024
469924d
Add validation to full traceback
AndreMarcel99 Nov 26, 2024
e44a31d
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Nov 26, 2024
4363173
Fix error message
AndreMarcel99 Nov 26, 2024
98f33be
Add fix type
AndreMarcel99 Nov 27, 2024
4e1b9b3
Add test case
AndreMarcel99 Nov 27, 2024
9be927a
Remove cp
AndreMarcel99 Nov 27, 2024
164a996
Fix dir_path
AndreMarcel99 Nov 28, 2024
0d48999
Add fragment
AndreMarcel99 Nov 28, 2024
216b104
Fix tracks and cylinder
AndreMarcel99 Nov 28, 2024
f6bb368
Add test case of space_type
AndreMarcel99 Nov 28, 2024
3aecd01
Add test cases for all positives cases
AndreMarcel99 Nov 29, 2024
95f5948
Update Github bug and enhancement templates with latest versions (#1820)
fernandofloresg Dec 2, 2024
2aef1b3
Merge branch 'dev' into enabler/1652/migrate_shell_call_cp_to_python_…
AndreMarcel99 Dec 2, 2024
776a66d
Update plugins/modules/zos_fetch.py
AndreMarcel99 Dec 2, 2024
9f2053c
Update plugins/modules/zos_fetch.py
AndreMarcel99 Dec 2, 2024
f8d5255
Update plugins/modules/zos_fetch.py
AndreMarcel99 Dec 2, 2024
cfcfc36
Fix execpton handle
AndreMarcel99 Dec 2, 2024
5da0601
Fix sanity
AndreMarcel99 Dec 2, 2024
9f04361
Adjust best practices
AndreMarcel99 Dec 2, 2024
4e444c6
Merge branch 'dev' into enabler/1589/volume_init_portability
AndreMarcel99 Dec 2, 2024
8cd43df
Add negative correct error
AndreMarcel99 Dec 2, 2024
04fcf3c
Fix sanity
AndreMarcel99 Dec 2, 2024
b559aab
Use raises
AndreMarcel99 Dec 3, 2024
ad8989e
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 3, 2024
04c3770
Merge pull request #1816 from ansible-collections/enabler/1652/migrat…
AndreMarcel99 Dec 4, 2024
cb6d498
Update mounts.env (#1826)
richp405 Dec 5, 2024
1c64254
[zos_mvs_raw] Find VSAM cluster when DISP=OLD and find data and index…
fernandofloresg Dec 5, 2024
fec1e17
Fix error messages and more
AndreMarcel99 Dec 5, 2024
c732781
Fix test cases issues positives and add negatives
AndreMarcel99 Dec 5, 2024
414613b
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 6, 2024
28d12b0
Fix resize call
AndreMarcel99 Dec 9, 2024
b79ce3d
Merge branch 'dev' into enabler/1589/volume_init_portability
AndreMarcel99 Dec 9, 2024
7a420e8
End portability
AndreMarcel99 Dec 10, 2024
3b813bc
Add fragment
AndreMarcel99 Dec 10, 2024
67ff6f4
[enabler][zos_copy]Add_error_message (#1821)
AndreMarcel99 Dec 10, 2024
8fcb91c
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 10, 2024
b10cea5
Get aggregation size available for everyone
AndreMarcel99 Dec 10, 2024
e40ccfb
Merge branch 'dev' into enabler/1589/volume_init_portability
AndreMarcel99 Dec 11, 2024
6a39b13
Fix no change on type
AndreMarcel99 Dec 11, 2024
d8faad9
Merge pull request #1830 from ansible-collections/enabler/1589/volume…
AndreMarcel99 Dec 11, 2024
9a49878
Add validation
AndreMarcel99 Dec 12, 2024
cd5fc23
Add extra asserts
AndreMarcel99 Dec 12, 2024
efe9bbd
Enhance error message
AndreMarcel99 Dec 12, 2024
5b56fc5
Add space
AndreMarcel99 Dec 12, 2024
742ebff
Updates to release notes and support for ansible-core 2.18 venv for A…
ddimatos Dec 12, 2024
3db400b
[Enabler] [AC tool] Add more options when testing with the AC tool (#…
rexemin Dec 12, 2024
1e7c6d4
Fix trace dataset
AndreMarcel99 Dec 12, 2024
6b209fb
Add trace
AndreMarcel99 Dec 12, 2024
06d659a
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 13, 2024
d033d4d
Add space
AndreMarcel99 Dec 16, 2024
816167c
[Enabler] [module_utils/copy.py] Replace calls to cp for dcp's Python…
rexemin Dec 16, 2024
11a5075
Add test cases
AndreMarcel99 Dec 16, 2024
3263091
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 16, 2024
58029a8
Add test case to validate test lineinfile
AndreMarcel99 Dec 16, 2024
e70cc1a
Add fragment
AndreMarcel99 Dec 16, 2024
2281ba7
Update tests/functional/modules/test_zos_lineinfile_func.py
AndreMarcel99 Dec 18, 2024
ff83a37
Update changelogs/fragments/1842-Add_test_case_to_validate_advance_re…
AndreMarcel99 Dec 18, 2024
9523b47
Update test_zos_lineinfile_func.py
AndreMarcel99 Dec 18, 2024
5aa6c8d
Validate use of members
AndreMarcel99 Dec 18, 2024
573dd9a
Add pds pdse and member fails
AndreMarcel99 Dec 18, 2024
fad3ff4
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 18, 2024
afe4f96
Fix sanity issues
AndreMarcel99 Dec 18, 2024
a62da4e
Fix error message and space_Type in lower case
AndreMarcel99 Dec 18, 2024
22c5927
Change names
AndreMarcel99 Dec 18, 2024
892325f
Add docstring
AndreMarcel99 Dec 18, 2024
3f23af5
Add documentation
AndreMarcel99 Dec 19, 2024
d20eed3
fix upper case
AndreMarcel99 Dec 19, 2024
3549fe8
Add comments
AndreMarcel99 Dec 19, 2024
f87e63d
Add ignore
AndreMarcel99 Dec 19, 2024
61a7957
Add documentation
AndreMarcel99 Dec 19, 2024
0f9a369
Try to fix the lint
AndreMarcel99 Dec 19, 2024
954f0ef
Final test case
AndreMarcel99 Dec 19, 2024
f2e833e
Fix two runs
AndreMarcel99 Dec 19, 2024
d536858
Delete uneccesary validation
AndreMarcel99 Dec 19, 2024
aa84dfb
Fix test case and add to github templates
AndreMarcel99 Dec 20, 2024
adf836c
Fix error return message
AndreMarcel99 Dec 20, 2024
1d5f2e5
Add test case
AndreMarcel99 Dec 20, 2024
1d0101a
Return functions
AndreMarcel99 Dec 20, 2024
1b9d0bd
Add member
AndreMarcel99 Dec 20, 2024
45554ec
Add test case
AndreMarcel99 Dec 20, 2024
d0f4649
Add test case
AndreMarcel99 Dec 20, 2024
ffca232
Add missing import
AndreMarcel99 Dec 20, 2024
425e360
Add missing import
AndreMarcel99 Dec 20, 2024
514e00c
Add documentation
AndreMarcel99 Dec 20, 2024
91ae341
Fix playbook
AndreMarcel99 Dec 20, 2024
d071c04
Fix error test case
AndreMarcel99 Dec 23, 2024
c1c3298
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Dec 24, 2024
1212543
Fix version of inventory
AndreMarcel99 Dec 24, 2024
9819598
Remove repeitive test case
AndreMarcel99 Dec 26, 2024
6982b35
Update plugins/module_utils/zfsadm.py
AndreMarcel99 Dec 30, 2024
5df8218
Add validation to avoid no auto increment
AndreMarcel99 Dec 30, 2024
6f3d5d3
Fix a comment
AndreMarcel99 Dec 30, 2024
853c1ff
Fix documentation
AndreMarcel99 Dec 30, 2024
af6eb51
Apply suggestions from code review
AndreMarcel99 Dec 30, 2024
99f5aa5
Add notes
AndreMarcel99 Dec 30, 2024
13b7eae
Scape points
AndreMarcel99 Dec 30, 2024
a365705
Scape points
AndreMarcel99 Jan 2, 2025
c86b421
Scape points
AndreMarcel99 Jan 2, 2025
b20425b
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Jan 2, 2025
edf8a8a
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Jan 3, 2025
9ecdc92
Update plugins/modules/zos_zfs_resize.py
AndreMarcel99 Jan 3, 2025
d6c912d
Add 2025 and adjust to comments
AndreMarcel99 Jan 3, 2025
417bb96
Add notes
AndreMarcel99 Jan 3, 2025
bd9100e
Fix errors
AndreMarcel99 Jan 3, 2025
d7e9290
Fix documentation problem
AndreMarcel99 Jan 3, 2025
51a9982
Fix comment and test case
AndreMarcel99 Jan 3, 2025
9fcba89
Fix comment
AndreMarcel99 Jan 3, 2025
c559616
Fix comment
AndreMarcel99 Jan 3, 2025
a275529
Fix comment
AndreMarcel99 Jan 3, 2025
6dd9e90
Fix error when creating one
AndreMarcel99 Jan 3, 2025
7430c50
Fix error when creating one
AndreMarcel99 Jan 3, 2025
e15e259
Fix error messaging
AndreMarcel99 Jan 3, 2025
4cf6cd7
Fix documentation
AndreMarcel99 Jan 3, 2025
6fa1544
Fix output
AndreMarcel99 Jan 3, 2025
fbf455c
Add extra validations
AndreMarcel99 Jan 3, 2025
4e17e0c
Fix resize
AndreMarcel99 Jan 3, 2025
e3364a9
Ensure proper size creation
AndreMarcel99 Jan 3, 2025
978e780
Fix eror assertion
AndreMarcel99 Jan 3, 2025
6c418a4
Add documenation and full verification
AndreMarcel99 Jan 6, 2025
0111b12
Merge branch 'dev' into module/1717/support_resizing
AndreMarcel99 Jan 6, 2025
4fb3874
Fix PDS and PDSE
AndreMarcel99 Jan 7, 2025
095ee97
Fix documentation
AndreMarcel99 Jan 8, 2025
9a17f73
Fix validation
AndreMarcel99 Jan 8, 2025
0e61364
Fix documentation and stderr for SEQ dataset
AndreMarcel99 Jan 9, 2025
be63f6c
Update documentation
AndreMarcel99 Jan 9, 2025
c927b3c
Fix names
AndreMarcel99 Jan 9, 2025
19d812f
Fix lint
AndreMarcel99 Jan 9, 2025
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_issue.yml
Original file line number Diff line number Diff line change
@@ -139,6 +139,7 @@ body:
- zos_tso_command
- zos_unarchive
- zos_volume_init
- zos_zfs_resize
validations:
required: false
- type: textarea
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/collaboration_issue.yml
Original file line number Diff line number Diff line change
@@ -146,5 +146,6 @@ body:
- zos_tso_command
- zos_unarchive
- zos_volume_init
- zos_zfs_resize
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/doc_issue.yml
Original file line number Diff line number Diff line change
@@ -83,5 +83,6 @@ body:
- zos_tso_command
- zos_unarchive
- zos_volume_init
- zos_zfs_resize
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/enabler_issue.yml
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ body:
- zos_tso_command
- zos_unarchive
- zos_volume_init
- zos_zfs_resize
validations:
required: false

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/enhancement_feature.issue.yml
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ body:
- zos_tso_command
- zos_unarchive
- zos_volume_init
- zos_zfs_resize
validations:
required: true

84 changes: 84 additions & 0 deletions plugins/module_utils/zfsadm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright (c) IBM Corporation 2025
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import, division, print_function
__metaclass__ = type


class zfsadm:
"""Provides an interface to execute zfsadm commands.
"""
def __init__(self, aggregate_name, module):
"""Initialize a class with its zfs dataset and allow modules to be executed.
Parameters
----------
aggregate_name : str
Name of the zfs dataset.
module : object
Ansible object to execute commands.
"""
self.aggregate_name = aggregate_name.upper()
self.module = module

def execute_resizing(self, operation, size, noai, verbose):
ddimatos marked this conversation as resolved.
Show resolved Hide resolved
"""Execute a grow or shrink operation on a zfs dataset.

Parameters
----------
operation : str
Whether the operation to execute is grow or shrink
size : int
Size to be assigned to the zfs
noai : str
Value for the no auto increase (noai) option when shrinking a dataset
verbose : str
Value for zfsadm's trace option specifying the output file for the command

Returns
-------
rc : int
The RC of the command executed.
stdout : str
The stdout of the executed command.
stderr : str
The stderr of the executed command.
cmd_str : str
The full command that was executed.
"""
if operation != "grow":
if operation != "shrink":
self.module.fail_json(msg=f"There is no operator {operation}")

cmd = f"-size {size}{noai}{verbose}"
cmd_str = f"zfsadm {operation} -aggregate {self.aggregate_name} {cmd}"

rc, stdout, stderr = self.module.run_command(cmd_str)

return rc, stdout, stderr, cmd_str

@staticmethod
def get_aggregate_size(aggregate_name, module):
"""Execute a command to get the size of a zfs dataset.

Returns
-------
rc : int
The rc of the executed command.
stdout : str
The stdout of the executed command
stderr : str
The stderr of the executed command.
"""
cmd = f"zfsadm aggrinfo {aggregate_name}"

rc, stdout, stderr = module.run_command(cmd)

return rc, stdout, stderr
Loading