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

Add support for fault sets to modules. #38

Merged
merged 35 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
30a7ece
add fault_set module, clean up sds
ctronco Jan 17, 2024
c1ef6a2
Add fs remove
ctronco Jan 17, 2024
8d19895
starting to add tests
ctronco Jan 18, 2024
f804838
fix required params for remove
ctronco Jan 18, 2024
05f543c
update collection version to 2.1.1
ctronco Jan 18, 2024
013c1a8
fix some typos, rework mod args
ctronco Jan 19, 2024
5f6473b
fixing tests
ctronco Jan 19, 2024
4b9a48f
tweaking CI Tests
ctronco Jan 19, 2024
5496500
more linting
ctronco Jan 19, 2024
9798671
yet more linting
ctronco Jan 19, 2024
52bb9fc
More linting, mod sanity ignores
ctronco Jan 19, 2024
4e6be67
still More linting, mod sanity ignores
ctronco Jan 19, 2024
bdb98b2
more sanity tweaks
ctronco Jan 19, 2024
9d20acb
more sanity tweaks
ctronco Jan 19, 2024
1705491
maybe last(?) sanity
ctronco Jan 19, 2024
ad5f85b
fingers crossed
ctronco Jan 19, 2024
e19e935
sanity ignore fix
ctronco Jan 19, 2024
7b60934
Add basic fault_set unit test
ctronco Jan 20, 2024
d0667e7
post test linting
ctronco Jan 20, 2024
d6cd7c0
Updates to documentation
ctronco Jan 22, 2024
7e73eeb
fixing doc error
ctronco Jan 22, 2024
a801b6a
remove extra whitespace
ctronco Jan 22, 2024
499d848
reset github actions workflow
ctronco Jan 22, 2024
84ba92e
Addressing initial PR comments
ctronco Feb 2, 2024
d5d5363
first pass addressing comments from @Bhavneet-Sharma
ctronco Feb 6, 2024
1201d9e
further changes, pd name inclusion
ctronco Feb 7, 2024
b2bf9dc
cleanup extra files
ctronco Feb 7, 2024
2ae8718
fix typos
ctronco Feb 7, 2024
522643e
resolve remaining comments, update docs
ctronco Feb 7, 2024
87d6b8d
Adding support for fault set rename and enhancing UT coverage
trisha-dell Feb 22, 2024
dac2249
Adding support for fault set rename and enhancing UT coverage
trisha-dell Feb 22, 2024
3950569
Adding support for fault set rename and enhancing UT coverage
trisha-dell Feb 22, 2024
0640ac6
Adding support for code coverage report
trisha-dell Feb 23, 2024
a541902
Adding support for code coverage report
trisha-dell Feb 23, 2024
6ecbc71
Adding support for code coverage report
trisha-dell Feb 23, 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
116 changes: 46 additions & 70 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
schedule:
- cron: '0 3 * * *'

Expand All @@ -15,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ansible-version: [stable-2.14]
ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -39,93 +38,68 @@ jobs:

###
# Unit tests (OPTIONAL)
#
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html

unit:
name: Unit Tests
name: Unit Tests (Ⓐ${{ matrix.ansible }} with ${{ matrix.python }} python)
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
ansible-version: [stable-2.14, stable-2.15, stable-2.16]
python: ['3.9', '3.10', '3.11']
ansible:
- stable-2.14
- stable-2.15
- stable-2.16
- devel
exclude:
# Ansible-core 2.16 is supported only from Python 3.10 onwards
- python-version: "3.9"
ansible-version: stable-2.16

- ansible: stable-2.16
python: '3.9'
- ansible: devel
python: '3.9'

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install ansible (${{ matrix.ansible-version }}) version
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check

- name: Download migrated collection artifacts
uses: actions/download-artifact@v1
- name: Perform unit testing with ansible-test
uses: ansible-community/ansible-test-gh-action@release/v1
with:
name: collection
path: .cache/collection-tarballs

- name: Setup Unit test Pre-requisites
run: |
ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
if [ -f /home/runner/.ansible/collections/ansible_collections/dellemc/powerflex/tests/requirements.txt ]; then pip install -r /home/runner/.ansible/collections/ansible_collections/dellemc/powerflex/tests/requirements.txt; fi

- name: Run Unit tests using ansible-test
run: ansible-test units -v --color --python ${{ matrix.python-version }} --coverage
working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/powerflex
testing-type: units
coverage: always
ansible-core-version: ${{ matrix.ansible }}
target-python-version: ${{ matrix.python }}

###
# Sanity tests (REQUIRED)
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html

sanity:
name: Sanity Tests
runs-on: ubuntu-latest
name: Sanity (Ⓐ${{ matrix.ansible }} with ${{ matrix.python }} python)
needs: [build]
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
ansible-version: [stable-2.14, stable-2.15, stable-2.16]
python: ['3.9', '3.10', '3.11']
ansible:
- stable-2.14
- stable-2.15
- stable-2.16
- devel
exclude:
# Ansible-core 2.16 is supported only from Python 3.10 onwards
- python-version: "3.9"
ansible-version: stable-2.16

- ansible: stable-2.16
python: '3.9'
- ansible: devel
python: '3.9'
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
# it is just required to run that once as "ansible-test sanity" in the docker image
# will run on all python versions it supports.
python-version: 3.11

- name: Install ansible (${{ matrix.ansible-version }}) version
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check

- name: Download migrated collection artifacts
uses: actions/download-artifact@v1
- name: Perform sanity testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
name: collection
path: .cache/collection-tarballs

- name: Setup Sanity test Pre-requisites
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz

# run ansible-test sanity inside of Docker.
# The docker container has all the pinned dependencies that are required
# and all python versions ansible supports.
- name: Run sanity tests
run: ansible-test sanity --docker -v --color
working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/powerflex
ansible-core-version: ${{ matrix.ansible }}
target-python-version: ${{ matrix.python }}
testing-type: sanity
pull-request-change-detection: true
coverage: never

lint:
name: Ansible lint
Expand All @@ -135,11 +109,13 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
ansible-version: [stable-2.14, stable-2.15, stable-2.16]
ansible-version: [stable-2.14, stable-2.15, stable-2.16, devel]
exclude:
# Ansible-core 2.16 is supported only from Python 3.10 onwards
- python-version: "3.9"
ansible-version: stable-2.16
- python-version: "3.9"
ansible-version: stable-2.16
- python-version: '3.9'
ansible-version: devel

steps:
# Important: This sets up your GITHUB_WORKSPACE environment variable
Expand All @@ -166,8 +142,8 @@ jobs:
path: .cache/collection-tarballs

- name: Install collection build
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz

- name: Run Ansible lint
run: ansible-lint --show-relpath
working-directory: /home/runner/work/ansible-powerflex/ansible-powerflex
working-directory: /home/runner/work/ansible-powerflex/ansible-powerflex
trisha-dell marked this conversation as resolved.
Show resolved Hide resolved
192 changes: 192 additions & 0 deletions docs/modules/fault_set.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
.. _fault_set_module


device -- Manage fault set on Dell PowerFlex
============================================

.. contents::
:local:
:depth: 1


Synopsis
--------

Managing fault sets on PowerFlex storage system includes adding, removing and egetting details of fault sets.



Requirements
------------
The below requirements are needed on the host that executes this module.

- A Dell PowerFlex storage system version 3.5 or later.
- Ansible-core 2.14 or later.
- PyPowerFlex 1.8.0.
- Python 3.9, 3.10 or 3.11.



Parameters
----------

fault_set_id(optional, str, None)
ID of the Fault Set being affected.
Mutually exclusive with *fault_set_name*

fault_set_name(optional, str, None)
Name of the Fault Set.
It is unique across the Powerflex Array.
Mutually exclusive with *fault_set_id*

fault_set_new_name(optional, str, None)
New Name of the Fault Set.
This is used to rename the fault set.

protection_domain_id (optional, str, None)
ID of the protection domain
Specify either *protection_domain_name* or *protection_domain_id* when creating a fault set

protection_domain_name(optional, str, None)
Name of protection domain.
Specify either *protection_domain_name* or *protection_domain_id* when creating a fault set

state (True, str, None)
State of the Fault Set.
choices: [present, absent]
type: str


hostname (True, str, None)
IP or FQDN of the PowerFlex host.


username (True, str, None)
The username of the PowerFlex host.


password (True, str, None)
The password of the PowerFlex host.


validate_certs (optional, bool, True)
Boolean variable to specify whether or not to validate SSL certificate.

``true`` - Indicates that the SSL certificate should be verified.

``false`` - Indicates that the SSL certificate should not be verified.


port (optional, int, 443)
Port number through which communication happens with PowerFlex host.


timeout (False, int, 120)
Time after which connection will get terminated.

It is to be mentioned in seconds.

Notes
-----

.. note::
- The *check_mode* is not supported.
- The modules present in the collection named as 'dellemc.powerflex' are built to support the Dell PowerFlex storage platform.



Examples
--------

.. code-block: yaml+jinja


- name: Create Fault Set on Protection Domain
dellemc.powerflex.fault_set:
hostname: "{{hostname}}"
username: "{{username}}"
password: "{{password}}"
validate_certs: "{{validate_certs}}"
fault_set_name: "{{fault_set_name}}"
protection_domain_name: "{{pd_name}}"
state: present

- name: Create Fault Set on Protection Domain
dellemc.powerflex.fault_set:
hostname: "{{hostname}}"
username: "{{username}}"
password: "{{password}}"
validate_certs: "{{validate_certs}}"
fault_set_name: "{{fault_set_name}}"
protection_domain_id: "{{pd_id}}"
state: present

- name: Delete Fault Set
dellemc.powerflex.fault_set:
hostname: "{{hostname}}"
username: "{{username}}"
password: "{{password}}"
validate_certs: "{{validate_certs}}"
fault_set_name: "{{fault_set_name}}"
state: absent

- name: Delete Fault Set
dellemc.powerflex.fault_set:
hostname: "{{hostname}}"
username: "{{username}}"
password: "{{password}}"
validate_certs: "{{validate_certs}}"
fault_set_id: "{{fault_set_id}}"
state: absent


Return Values:
--------------
changed(always, bool, false)
Whether or not the resource has changed.

fault_set_details (when fault set exists, dict, { 'protectionDomainId': 'da721a8300000000', 'protectionDomainName': 'pd001', 'name': 'fs_001','id': 'eb44b70500000000','links': [{ 'rel': 'self', 'href': '/api/instances/FaultSet::eb44b70500000000' }, {'rel': '/api/FaultSet/relationship/Statistics', 'href': '/api/instances/FaultSet::eb44b70500000000/relationships/Statistics'},{'rel': '/api/FaultSet/relationship/Sds', 'href': '/api/instances/FaultSet::eb44b70500000000/relationships/Sds' }, { 'rel': '/api/parent/relationship/protectionDomainId', 'href': '/api/instances/ProtectionDomain::da721a8300000000' }})
Details of fault set.


protectionDomainId(, str,):
The ID of the protection domain.


protectionDomainName(, str,):
The name of the protection domain.


name(, str,)
fault set name.


id(, str,)
fault set id


links (, list, )
Device links.


href (, str, )
Device instance URL.


rel (, str, )
Relationship of device with different entities.


Status
------





Authors
~~~~~~~

- Carlos Tronco (@ctronco) <[email protected]>


Loading
Loading