-
Notifications
You must be signed in to change notification settings - Fork 5
fix: problem with bootable flag not getting passed properly to snapm #138
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
3 commits
Select commit
Hold shift + click to select a range
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,15 @@ | ||
| # get_snapset_status.yml | ||
| - name: Invoke snapm for {{ snapset_name }} | ||
| ansible.builtin.command: snapm snapset show {{ snapset_name | quote }} -j | ||
| register: snapm_raw | ||
| changed_when: false | ||
|
|
||
| - name: Parse and set facts | ||
| ansible.builtin.set_fact: | ||
| # Extracting the first dictionary from the JSON list | ||
| _raw_data: "{{ snapm_raw.stdout | from_json | first }}" | ||
|
|
||
| - name: Define reusable variables | ||
| ansible.builtin.set_fact: | ||
| is_bootable: "{{ _raw_data.Bootable | bool }}" | ||
| boot_entries_list: "{{ _raw_data.BootEntries.values() | list }}" |
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,143 @@ | ||
| --- | ||
| - name: Basic snapshot test | ||
richm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| hosts: all | ||
| vars: | ||
| # only use vgs matching this pattern | ||
| snapshot_lvm_vg_include: "^test_" | ||
| 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%" | ||
| tasks: | ||
| - name: Run tests | ||
| block: | ||
| - name: Setup | ||
| include_tasks: tasks/setup.yml | ||
|
|
||
| - name: Run the snapshot role to create snapshot LVs | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_percent_space_required: 15 | ||
| snapshot_lvm_all_vgs: true | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_action: snapshot | ||
| snapshot_lvm_bootable: true | ||
|
|
||
| - name: Assert changes for creation | ||
| assert: | ||
| that: snapshot_cmd["changed"] | ||
|
|
||
| - name: Verify the snapshot LVs are created | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_all_vgs: true | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_verify_only: true | ||
| snapshot_lvm_action: check | ||
|
|
||
| - name: Run the snapshot role again to check idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_percent_space_required: 15 | ||
| snapshot_lvm_all_vgs: true | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_action: snapshot | ||
|
|
||
| - name: Assert no changes for creation | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
|
|
||
| - name: Verify again to check idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_all_vgs: true | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_verify_only: true | ||
| snapshot_lvm_action: check | ||
|
|
||
| - name: Assert no changes for verify | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
|
|
||
| - name: Run the snapshot role remove the snapshot LVs | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_action: remove | ||
|
|
||
| - name: Assert changes for removal | ||
| assert: | ||
| that: snapshot_cmd["changed"] | ||
|
|
||
| - name: Use the snapshot_lvm_verify option to make sure remove is done | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_verify_only: true | ||
| snapshot_lvm_action: remove | ||
|
|
||
| - name: Remove again to check idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_action: remove | ||
|
|
||
| - name: Assert no changes for remove | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
|
|
||
| - name: Verify remove again to check idempotence | ||
| include_role: | ||
| name: linux-system-roles.snapshot | ||
| vars: | ||
| snapshot_lvm_snapset_name: snapset1 | ||
| snapshot_lvm_verify_only: true | ||
| snapshot_lvm_action: remove | ||
|
|
||
| - name: Assert no changes for remove verify | ||
| assert: | ||
| that: not snapshot_cmd["changed"] | ||
|
|
||
| rescue: | ||
| - name: Do not fail if snapm is too old for test | ||
| assert: | ||
| that: ansible_failed_result.msg is search(msg1) or ansible_failed_result.msg is search(msg2) | ||
| vars: | ||
| msg1: "Package snapm version .* is too old" | ||
| msg2: "Package snapm version 0.5 or later is required to use bootable snapsets" | ||
|
|
||
| always: | ||
| - name: Cleanup | ||
| include_tasks: tasks/cleanup.yml | ||
| tags: tests::cleanup | ||
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
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.