generated from linux-system-roles/template
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add support for "bootable" snapshots #115
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
234f3d8
feat: add support for "bootable" snapshots
trgill 4127e4b
feat: some suggested fixes
richm 7b64414
Merge pull request #8 from richm/richm-add_bootable
trgill 04ec9a4
fail the role
richm d766e42
Merge pull request #9 from richm/richm-add_bootable-2
trgill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| # Primarily for testing unreleased versions | ||
| - name: Enable snapm copr on Fedora | ||
| command: dnf -y copr enable packit/snapshotmanager-snapm-357 | ||
| when: ansible_facts['distribution'] == 'Fedora' | ||
| changed_when: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| --- | ||
| - name: Snapshot a set of volumes with snapshot_lvm_bootable set to true | ||
| hosts: all | ||
| vars: | ||
| test_disk_min_size: "1g" | ||
| test_disk_count: 10 | ||
| test_storage_pools: | ||
| - name: test_vg1 | ||
| disks: "{{ range(0, 3) | map('extract', unused_disks) | list }}" | ||
| volumes: | ||
| - name: lv1 | ||
| size: "15%" | ||
| - name: lv2 | ||
| size: "50%" | ||
| - name: test_vg2 | ||
| disks: "{{ range(3, 6) | map('extract', unused_disks) | list }}" | ||
| volumes: | ||
| - name: lv3 | ||
| size: "10%" | ||
| - name: lv4 | ||
| size: "20%" | ||
| - name: test_vg3 | ||
| disks: "{{ range(6, 10) | map('extract', unused_disks) | list }}" | ||
| volumes: | ||
| - name: lv5 | ||
| size: "30%" | ||
| - name: lv6 | ||
| size: "25%" | ||
| - name: lv7 | ||
| size: "10%" | ||
| - name: lv8 | ||
| size: "10%" | ||
| snapshot_test_set: | ||
| name: snapset1 | ||
| volumes: | ||
| - name: snapshot VG1 LV1 | ||
| vg: test_vg1 | ||
| lv: lv1 | ||
| percent_space_required: 20 | ||
| - name: snapshot VG2 LV3 | ||
| vg: test_vg2 | ||
| lv: lv3 | ||
| percent_space_required: 15 | ||
| - name: snapshot VG2 LV4 | ||
| vg: test_vg2 | ||
| lv: lv4 | ||
| percent_space_required: 15 | ||
| - name: snapshot VG3 LV7 | ||
| vg: test_vg3 | ||
| lv: lv7 | ||
| percent_space_required: 15 | ||
| snapshot_lvm_bootable: true | ||
| tasks: | ||
| - name: Load test variables | ||
| include_vars: | ||
| file: vars/rh_distros_vars.yml | ||
| when: __snapshot_is_ostree is not defined | ||
|
|
||
| - name: Run tests | ||
| block: | ||
| - name: Setup | ||
| include_tasks: tasks/setup.yml | ||
|
|
||
| - name: Run the snapshot role to create snapshot set of LVs | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: snapshot | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
|
||
| - name: Assert changes for create snapset | ||
| assert: | ||
| that: snapshot_cmd["changed"] | ||
|
|
||
| - name: Run the snapshot role to verify the set of snapshots for the LVs | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: check | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
| snapshot_lvm_verify_only: true | ||
|
|
||
| - name: Create snapset again for idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: snapshot | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
|
||
| - name: Assert no changes for create snapset | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
|
|
||
| - name: Run the snapshot role remove the set | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: remove | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
|
||
| - name: Assert changes for remove snapset | ||
| assert: | ||
| that: snapshot_cmd["changed"] | ||
|
|
||
| - name: Run the snapshot role to verify the set is removed | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: remove | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
| snapshot_lvm_verify_only: true | ||
|
|
||
| - name: Remove again to check idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_action: remove | ||
| snapshot_lvm_set: "{{ snapshot_test_set }}" | ||
|
|
||
| - name: Assert no changes for remove snapset | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
| rescue: | ||
| - name: Check if error is due to snapm version too old | ||
| fail: | ||
| msg: Unexpected error occurred {{ ansible_failed_result | to_nice_json }} | ||
| when: not ansible_failed_result.msg is search(err_msg) | ||
| vars: | ||
| err_msg: Package snapm .*version 0.5 or later is required to use bootable snapsets | ||
| always: | ||
| - name: Cleanup | ||
| include_tasks: tasks/cleanup.yml | ||
| tags: tests::cleanup |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a task here to check the snapm version, and fail, or exit, if
snapshot_lvm_bootableis true - for example, in the podman role, we do something similar to check if the user wants to use advanced features not available on some platforms - https://github.com/linux-system-roles/podman/blob/main/tasks/main.yml#L47-L79snapshot_snapm_versionsnapshot_lvm_bootable | d(false)andsnapshot_snapm_version is version("<", "0.12")andsnapshot_fail_if_too_old | d(true)- then use thefail:module to report failuresnapshot_lvm_bootable | d(false)andsnapshot_snapm_version is version("<", "0.12")andnot snapshot_fail_if_too_old | d(true)- then useend_host:to skip the role without a failureThis:
snapshot_fail_if_too_old: false)