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 124 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
124 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
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
79 changes: 79 additions & 0 deletions plugins/module_utils/zfsadm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright (c) IBM Corporation 2024
# 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 grow_shrink(self, operation, cmd):
fernandofloresg marked this conversation as resolved.
Show resolved Hide resolved
fernandofloresg marked this conversation as resolved.
Show resolved Hide resolved
"""Execute grow or shrink operation over a zfs dataset.

Parameters
----------
operation : str
Whether the operation to execute is grow or shrink
cmd : str
Arguments to be added to the zfsadm -aggregate command"".

Returns
-------
rc : int
The rc of the execution of command.
stdout : str
The stout of the execution of command.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The stout of the execution of command.
The stdout of the execution of command.

stderr : str
The stderr of the execution of command.
cmd_str : str
The full command that was execute.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The full command that was execute.
The full command that was executed.

"""
cmd_str = "zfsadm {0} -aggregate {1} {2}".format(operation, self.aggregate_name, cmd)

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

return rc, stdout, stderr, cmd_str


def get_agg_size(self):
fernandofloresg marked this conversation as resolved.
Show resolved Hide resolved
"""Execute a command to get the size of the zfs dataset.

Returns
-------
rc : int
The rc of the execution of command.
stdout : str
The stout of the execution of command
fernandofloresg marked this conversation as resolved.
Show resolved Hide resolved
stderr : str
The stderr of the execution of command.
"""
cmd = "zfsadm aggrinfo {0}".format(self.aggregate_name)

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

return rc, stdout, stderr

Loading
Loading