Skip to content

Commit

Permalink
Support for restoring a snapshot (#47)
Browse files Browse the repository at this point in the history
* Support for restoring a snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring snapshot

* Adding support for restoring a snapshot
  • Loading branch information
trisha-dell authored Jul 23, 2024
1 parent 044dba2 commit 4dcc67a
Show file tree
Hide file tree
Showing 11 changed files with 1,289 additions and 386 deletions.
100 changes: 36 additions & 64 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 Down Expand Up @@ -39,93 +38,67 @@ 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.10", "3.11"]
ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel]
python: ['3.10', '3.11']
ansible:
- stable-2.15
- stable-2.16
- stable-2.17
- devel
exclude:
# Ansible-core 2.16 is supported only from Python 3.10 onwards
- python-version: "3.10"
ansible-version: devel

- ansible: devel
python: '3.10'

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
testing-type: units
coverage: always
ansible-core-version: ${{ matrix.ansible }}
target-python-version: ${{ matrix.python }}

- 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/powermax/tests/requirements.txt ]; then pip install -r /home/runner/.ansible/collections/ansible_collections/dellemc/powermax/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/powermax

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

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

steps:
- name: Set up Python 3.11
uses: actions/setup-python@v4
- name: Perform sanity testing
uses: ansible-community/ansible-test-gh-action@release/v1
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
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/powermax
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 @@ -137,9 +110,8 @@ jobs:
python-version: ["3.10", "3.11"]
ansible-version: [stable-2.15, stable-2.16, stable-2.17, devel]
exclude:
# Ansible-core 2.16 is supported only from Python 3.10 onwards
- python-version: "3.10"
ansible-version: devel
- ansible-version: devel
python-version: '3.10'

steps:
# Important: This sets up your GITHUB_WORKSPACE environment variable
Expand All @@ -149,7 +121,7 @@ jobs:
fetch-depth: 0 # needed for progressive mode to work

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

Expand Down
147 changes: 74 additions & 73 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,74 @@
---
### REQUIRED

# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: dellemc

# The name of the collection. Has the same character restrictions as 'namespace'
name: powermax

# The version of the collection. Must be compatible with semantic versioning
version: 3.0.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Akash Shendge <ansible.team@dell.com>
- Ambuj Dubey <ansible.team@dell.com>
- Arindam Datta <ansible.team@dell.com>
- Ashish Verma <ansible.team@dell.com>
- Manisha Agrawal <ansible.team@dell.com>
- Prashant Rakheja <ansible.team@dell.com>
- Rajshree Khare <ansible.team@dell.com>
- Vasudevu Lakhinana <ansible.team@dell.com>
- Rajendra Indukuri <ansible.team@dell.com>
- Spandita Panigrahi <ansible.team@dell.com>
- Meenakshi Dembi <ansible.team@dell.com>
- Pavan Mudunuri <ansible.team@dell.com>
- Trisha Datta <ansible.team@dell.com>


### OPTIONAL but strongly recommended

# A short summary description of the collection
description: Ansible modules for PowerMax

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-3.0-or-later
- Apache-2.0

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: [storage]

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: https://github.com/dell/ansible-powermax/tree/3.0.0

# The URL to any online docs
documentation: https://github.com/dell/ansible-powermax/tree/3.0.0/docs

# The URL to the homepage of the collection/project
homepage: https://github.com/dell/ansible-powermax/tree/3.0.0

# The URL to the collection issue tracker
issues: https://www.dell.com/community/Automation/bd-p/Automation

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered
build_ignore: []
---
### REQUIRED

# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: dellemc

# The name of the collection. Has the same character restrictions as 'namespace'
name: powermax

# The version of the collection. Must be compatible with semantic versioning
version: 3.1.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Akash Shendge <ansible.team@dell.com>
- Ambuj Dubey <ansible.team@dell.com>
- Arindam Datta <ansible.team@dell.com>
- Ashish Verma <ansible.team@dell.com>
- Manisha Agrawal <ansible.team@dell.com>
- Prashant Rakheja <ansible.team@dell.com>
- Rajshree Khare <ansible.team@dell.com>
- Vasudevu Lakhinana <ansible.team@dell.com>
- Rajendra Indukuri <ansible.team@dell.com>
- Spandita Panigrahi <ansible.team@dell.com>
- Meenakshi Dembi <ansible.team@dell.com>
- Pavan Mudunuri <ansible.team@dell.com>
- Trisha Datta <ansible.team@dell.com>


### OPTIONAL but strongly recommended

# A short summary description of the collection
description: Ansible modules for PowerMax

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-3.0-or-later
- Apache-2.0

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: [storage]

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: https://github.com/dell/ansible-powermax/tree/main

# The URL to any online docs
documentation: https://github.com/dell/ansible-powermax/tree/main/docs

# The URL to the homepage of the collection/project
homepage: https://github.com/dell/ansible-powermax/tree/main

# The URL to the collection issue tracker
issues: https://www.dell.com/community/Automation/bd-p/Automation

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered
build_ignore:
- codecov.yml
28 changes: 28 additions & 0 deletions playbooks/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,34 @@
snapshot_id: "{{ snapshot_id }}"
state: "{{ state_present }}"

- name: Restore Storage Group Snapshot using generation
dellemc.powermax.snapshot:
unispherehost: "{{ unispherehost }}"
universion: "{{ universion }}"
verifycert: "{{ verifycert }}"
user: "{{ user }}"
password: "{{ password }}"
serial_no: "{{ serial_no }}"
sg_name: "{{ sg_name }}"
snapshot_name: "{{ snapshot_name }}"
restore: true
generation: "{{ generation }}"
state: "{{ state_present }}"

- name: Restore Storage Group Snapshot using snapshot_id
dellemc.powermax.snapshot:
unispherehost: "{{ unispherehost }}"
universion: "{{ universion }}"
verifycert: "{{ verifycert }}"
user: "{{ user }}"
password: "{{ password }}"
serial_no: "{{ serial_no }}"
sg_name: "{{ sg_name }}"
snapshot_name: "{{ snapshot_name }}"
restore: true
snapshot_id: "{{ snapshot_id }}"
state: "{{ state_present }}"

- name: Delete Storage Group Snapshot using generation
dellemc.powermax.snapshot:
unispherehost: "{{ unispherehost }}"
Expand Down
Loading

0 comments on commit 4dcc67a

Please sign in to comment.