Skip to content

feat(purefa_pgsnap): Add restore=all to restore all volumes from pgroup snapshot#994

Draft
sdodsley wants to merge 2 commits into
masterfrom
feat/purefa-pgsnap-restore-all
Draft

feat(purefa_pgsnap): Add restore=all to restore all volumes from pgroup snapshot#994
sdodsley wants to merge 2 commits into
masterfrom
feat/purefa-pgsnap-restore-all

Conversation

@sdodsley
Copy link
Copy Markdown
Member

Summary

Adds a new feature to the purefa_pgsnap module that allows restoring all member volumes from a protection group snapshot at once using restore: all.

Closes #993

Changes

New Feature: restore=all

When restore is set to all, the module uses post_protection_groups() to restore all member volumes at once instead of iterating through each volume individually. This is more efficient and maintains consistency.

Behavior

Scenario Behavior
restore=all + target is new PG overwrite=False allowed - creates new PG with copies of all volumes
restore=all + target not specified Defaults to source PG name, overwrite=True required
restore=all + target is existing PG overwrite=True required

Restrictions

  • add_to_pgs is not supported with restore=all
  • with_default_protection=False is not supported with restore=all

Examples

# Restore all volumes in-place (overwrite existing)
- name: Restore all volumes from protection group snapshot foo.snap
  purestorage.flasharray.purefa_pgsnap:
    name: foo
    suffix: snap
    restore: all
    overwrite: true
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: copy

# Clone all volumes to a new protection group
- name: Clone all volumes from snapshot to new protection group
  purestorage.flasharray.purefa_pgsnap:
    name: foo
    suffix: snap
    restore: all
    target: foo_clone
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: copy

Testing

67 tests passed
Coverage: 87%

New Tests Added

  • test_restore_all_to_new_pgroup - Restore all volumes to a new protection group
  • test_restore_all_overwrite_existing - Restore all volumes overwriting existing protection group
  • test_restore_all_existing_without_overwrite_fails - Fails when target exists and overwrite=False
  • test_restore_all_with_latest_suffix - Handles 'latest' suffix resolution
  • test_restore_all_check_mode - Check mode doesn't make API calls
  • test_restore_all_older_api_version - Works with older API versions
  • test_main_restore_all_calls_restore_pgsnapshot_all - main() calls correct function
  • test_main_restore_all_fails_with_add_to_pgs - Validation fails with add_to_pgs
  • test_main_restore_all_fails_with_default_protection_false - Validation fails with with_default_protection=False
  • test_main_restore_all_target_not_defaulted_to_all - Target not incorrectly set to 'all'

Pull Request opened by Augment Code with guidance from the PR author

@sdodsley sdodsley added documentation Improvements or additions to documentation enhancement New feature or request unittests Unit Tests labels Apr 21, 2026
@sdodsley sdodsley self-assigned this Apr 21, 2026
…up snapshot

- Add new restore_pgsnapshot_all() function that uses post_protection_groups()
  to restore all member volumes at once instead of iterating individually
- When restore=all and target is a new (non-existent) protection group,
  overwrite=False is allowed (creates new PG with copies)
- When restore=all and target exists, overwrite=True is required
- Target parameter can specify a different protection group name
- If target not specified, defaults to the source protection group name
- add_to_pgs and with_default_protection are not supported with restore=all

Closes #993
@sdodsley sdodsley force-pushed the feat/purefa-pgsnap-restore-all branch 3 times, most recently from e417838 to 630d2c2 Compare April 21, 2026 18:50
@sdodsley sdodsley force-pushed the feat/purefa-pgsnap-restore-all branch from 630d2c2 to 26a1cd9 Compare April 21, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request unittests Unit Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

revert all volumes of a certain protection group snapshot

1 participant