Skip to content

Commit

Permalink
Ansible module to enable the user to provision CPGs on HPE StoreServ …
Browse files Browse the repository at this point in the history
…3PAR device (ansible#39656)

* Added storage modules and unit tests

Removed unnecessary file

Fixing pep8 issues

Adding reusable documentation to the data fragment file

Fixing issues reported by module validation in documentation

Fixed issues: 10549, 10553

Fixed unit tests

Added future imports and removed license from init py file

Resolved import issue reported by ansible sanity test

Fixed unit tests

Adding CPG management module

Fixing sanity test issues

Resolving line ending issues

Resolved import issue reported by ansible sanity test

Correcting the error message when resource is more than 31 char

Update hpe3par_cpg.py

Fix for defect 10556: Unable to modify volume. Persona not set

Fix for defect 10556: Unable to modify volume. Persona not set

Fixing pep8 changes

Fixed pep8 issues

Added more pep8 related fixes

Added more pep8 related fixes

Fixed rebase issue in cps test

Adding GPL3.0+ License (#7)

* Update hpe3par.py

* Update hpe3par_cpg.py

* Update hpe3par_cpg.py

Adding GPLV3+ only license

Fix anity test

Addressing review comments

Fixing undefined variable error

Addressed review comments and added more unit tests (#8)

Added maintainers

Fixed sanity test

Update test_hpe3par_cpg.py

Renamed the module as per the review comments (#9)

* Added maintainers

* Renaming the module to remove the vendor name from the module

* remove pep8 related issues

Modify the requirements to add version of 3par sdk

Review address (#10)

* Unit is no longer a different paramter in the task

* Fixing unit tests

* Taking into account the default values

Fixing issue with default values

fixing unit test

Adding more flexibility and checks to the size and it's units

Fixed pylint extra line issue

Fixing conflicts in BOTMETA.yml

Made changes according to the review comments

Updating ansible version

Refactored the code to move reusable method to module utils

Modified the GPLv3+ license text according to the review comments. Modified the module utils license to BSD

Corrected the BOTMETA entry. Fixed the pep8 issues

Fixing entries in BOTMETA.yml

Removed ansible version, renamed the version to address the name review comments

Reverting name change for module to revert test failures

Set size and raid type and now reuqired together based on the review comment

Fixed unit tests

Removing default value as raid and set size are now required together

Renaming the modules to ss_3par_*

Resolving the pep8 issues

Added storage modules and unit tests

Removed unnecessary file

Fixing pep8 issues

Adding reusable documentation to the data fragment file

Fixing issues reported by module validation in documentation

Fixed issues: 10549, 10553

Fixed unit tests

Added future imports and removed license from init py file

Resolved import issue reported by ansible sanity test

Fixed unit tests

Adding CPG management module

Fixing sanity test issues

Resolving line ending issues

Resolved import issue reported by ansible sanity test

Correcting the error message when resource is more than 31 char

Update hpe3par_cpg.py

Fix for defect 10556: Unable to modify volume. Persona not set

Fix for defect 10556: Unable to modify volume. Persona not set

Fixing pep8 changes

Fixed pep8 issues

Added more pep8 related fixes

Added more pep8 related fixes

Fixed rebase issue in cps test

Adding GPL3.0+ License (#7)

* Update hpe3par.py

* Update hpe3par_cpg.py

* Update hpe3par_cpg.py

Adding GPLV3+ only license

Fix anity test

Addressing review comments

Fixing undefined variable error

Addressed review comments and added more unit tests (#8)

Added maintainers

Fixed sanity test

Update test_hpe3par_cpg.py

Renamed the module as per the review comments (#9)

* Added maintainers

* Renaming the module to remove the vendor name from the module

* remove pep8 related issues

Modify the requirements to add version of 3par sdk

Review address (#10)

* Unit is no longer a different paramter in the task

* Fixing unit tests

* Taking into account the default values

Fixing issue with default values

fixing unit test

Adding more flexibility and checks to the size and it's units

Fixed pylint extra line issue

Fixing conflicts in BOTMETA.yml

Made changes according to the review comments

Updating ansible version

Refactored the code to move reusable method to module utils

Modified the GPLv3+ license text according to the review comments. Modified the module utils license to BSD

Corrected the BOTMETA entry. Fixed the pep8 issues

Removed ansible version, renamed the version to address the name review comments

Reverting name change for module to revert test failures

Set size and raid type and now reuqired together based on the review comment

Fixed unit tests

Removing default value as raid and set size are now required together

Renaming the modules to ss_3par_*

Resolving the pep8 issues

Update lib/ansible/modules/storage/hpe3par/ss_3par_cpg.py

Co-Authored-By: farhan7500 <farhan7500@gmail.com>

Update lib/ansible/modules/storage/hpe3par/ss_3par_cpg.py

Co-Authored-By: farhan7500 <farhan7500@gmail.com>

Fixed rebase issue

Fixed rebase issuein BOTMETA.yml

* Modified the documentation based on the review comments

* Fixed the pep8 sanity issue

* Moved the doc fragment file based on latest changes

* Reverting inadvertent rebase changes

* Fixed inadvertent change during rebase
  • Loading branch information
farhan7500 authored and gundalow committed Feb 26, 2019
1 parent 076562e commit 27804b3
Show file tree
Hide file tree
Showing 8 changed files with 662 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/BOTMETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ files:
labels: gitlab
maintainers: $team_gitlab
notified: jlozadad
$modules/storage/hpe3par/: farhan7500 gautamphegde
$modules/storage/infinidat/: GR360RY vmalloc
$modules/storage/netapp/: $team_netapp
$modules/storage/purestorage/:
Expand Down Expand Up @@ -782,6 +783,9 @@ files:
$module_utils/vultr.py: *vultr
$module_utils/xenserver.py:
maintainers: bvitnik
$module_utils/storage/hpe3par/hpe3par.py: &hpe3par
maintainers: farhan7500 gautamphegde
support: community

###############################
# playbook
Expand Down Expand Up @@ -1060,6 +1064,7 @@ files:
$plugins/doc_fragments/vultr.py: *vultr
$plugins/doc_fragments/xenserver.py:
maintainers: bvitnik
$plugins/doc_fragments/hpe3par.py: *hpe3par
###############################
# plugins/filter
$plugins/filter/:
Expand Down Expand Up @@ -1339,6 +1344,7 @@ files:
labels:
- networking
test/units/modules/cloud/xenserver/: bvitnik
test/units/modules/storage/hpe3par: *hpe3par
test/sanity/pep8/legacy-files.txt:
notified: mattclay
hacking/report.py:
Expand Down
Empty file.
90 changes: 90 additions & 0 deletions lib/ansible/module_utils/storage/hpe3par/hpe3par.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright: (c) 2018, Hewlett Packard Enterprise Development LP
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)

from ansible.module_utils import basic


def convert_to_binary_multiple(size_with_unit):
if size_with_unit is None:
return -1
valid_units = ['MiB', 'GiB', 'TiB']
valid_unit = False
for unit in valid_units:
if size_with_unit.strip().endswith(unit):
valid_unit = True
size = size_with_unit.split(unit)[0]
if float(size) < 0:
return -1
if not valid_unit:
raise ValueError("%s does not have a valid unit. The unit must be one of %s" % (size_with_unit, valid_units))

size = size_with_unit.replace(" ", "").split('iB')[0]
size_kib = basic.human_to_bytes(size)
return int(size_kib / (1024 * 1024))


storage_system_spec = {
"storage_system_ip": {
"required": True,
"type": "str"
},
"storage_system_username": {
"required": True,
"type": "str",
"no_log": True
},
"storage_system_password": {
"required": True,
"type": "str",
"no_log": True
},
"secure": {
"type": "bool",
"default": False
}
}


def cpg_argument_spec():
spec = {
"state": {
"required": True,
"choices": ['present', 'absent'],
"type": 'str'
},
"cpg_name": {
"required": True,
"type": "str"
},
"domain": {
"type": "str"
},
"growth_increment": {
"type": "str",
},
"growth_limit": {
"type": "str",
},
"growth_warning": {
"type": "str",
},
"raid_type": {
"required": False,
"type": "str",
"choices": ['R0', 'R1', 'R5', 'R6']
},
"set_size": {
"required": False,
"type": "int"
},
"high_availability": {
"type": "str",
"choices": ['PORT', 'CAGE', 'MAG']
},
"disk_type": {
"type": "str",
"choices": ['FC', 'NL', 'SSD']
}
}
spec.update(storage_system_spec)
return spec
Empty file.

0 comments on commit 27804b3

Please sign in to comment.