Skip to content

Commit

Permalink
Merge pull request #38 from ctronco/add_fault_set
Browse files Browse the repository at this point in the history
Add support for fault sets to modules.
  • Loading branch information
Bhavneet-Sharma authored Feb 27, 2024
2 parents 7d9eeda + 6ecbc71 commit b85b7e4
Show file tree
Hide file tree
Showing 28 changed files with 2,933 additions and 443 deletions.
114 changes: 45 additions & 69 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,7 +142,7 @@ 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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output
__pycache__/
*.log
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
fixes:
- "/ansible_collections/dellemc/powerflex/::"
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

0 comments on commit b85b7e4

Please sign in to comment.