-
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
Conversation
Reviewer's GuideThis PR introduces support for bootable LVM snapshots by adding a new snapshot_lvm_bootable flag (and experimental snapshot_use_copr option), propagating it through parameters, module utilities, tasks, and the snapshot library, updating documentation, and adding tests and conditional Copr repository setup. Sequence diagram for bootable snapshot creation flowsequenceDiagram
participant User as actor User
participant AnsiblePlaybook as Ansible Playbook
participant SnapshotModule as snapshot.py
participant LVMUtil as lvm.py
participant SnapMgrUtil as snapmgr.py
participant SnapManager as SnapManager
User->>AnsiblePlaybook: Run playbook with snapshot_lvm_bootable: true
AnsiblePlaybook->>SnapshotModule: Pass snapshot_lvm_bootable param
SnapshotModule->>LVMUtil: Build args with bootable flag
LVMUtil->>SnapMgrUtil: Pass bootable in snapset_json
SnapMgrUtil->>SnapManager: create_snapshot_set(..., boot=bootable)
SnapManager-->>SnapMgrUtil: Create snapshot and boot menu entry
SnapMgrUtil-->>LVMUtil: Return result
LVMUtil-->>SnapshotModule: Return result
SnapshotModule-->>AnsiblePlaybook: Return result
AnsiblePlaybook-->>User: Report snapshot and boot entry created
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- Duplicate extraction of the snapshot_lvm_bootable parameter in validate.py and lvm.py could be refactored into a shared helper to reduce code repetition.
- The enable_copr task hardcodes the Copr repo URL—consider making that repository name/version configurable so it isn’t tied to a single Copr build.
- Add an explicit platform guard or skip logic around the bootable flag to prevent invoking snapm boot options on hosts that don’t support snapshot manager.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Duplicate extraction of the snapshot_lvm_bootable parameter in validate.py and lvm.py could be refactored into a shared helper to reduce code repetition.
- The enable_copr task hardcodes the Copr repo URL—consider making that repository name/version configurable so it isn’t tied to a single Copr build.
- Add an explicit platform guard or skip logic around the bootable flag to prevent invoking snapm boot options on hosts that don’t support snapshot manager.
## Individual Comments
### Comment 1
<location> `tasks/enable_copr.yml:6` </location>
<code_context>
+- name: Enable snapm copr on Fedora
+ command: dnf -y copr enable packit/snapshotmanager-snapm-433
+ when: ansible_facts['distribution'] == 'Fedora'
+ changed_when: true
\ No newline at end of file
</code_context>
<issue_to_address>
Setting 'changed_when: true' may cause misleading change reporting.
This will always mark the task as changed, even if no action was needed. Use a more precise condition or a module that detects actual changes.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @@ -10,6 +10,10 @@ | |||
| use: "{{ (__snapshot_is_ostree | d(false)) | | |||
| ternary('ansible.posix.rhel_rpm_ostree', omit) }}" | |||
|
|
|||
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_bootable is 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-L79
- install packages
- get the snapm version - set the version in a global variable e.g.
snapshot_snapm_version - if
snapshot_lvm_bootable | d(false)andsnapshot_snapm_version is version("<", "0.12")andsnapshot_fail_if_too_old | d(true)- then use thefail:module to report failure - if
snapshot_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 failure
This:
- lets the user of the role know that they are using an unsupported feature
- allows the tests to pass when testing with an older version of snapm (by having the test set
snapshot_fail_if_too_old: false)
95607e4 to
aad1973
Compare
abd27c8 to
43d20a6
Compare
|
[citest] |
|
@richm snapm has been released with support for bootable snapsets. This is ready for review now. |
|
[citest] |
205010f to
54f1f44
Compare
tests/tests_set_bootable.yml
Outdated
| msg: > | ||
| This test is only supported on platforms with snapm support. | ||
| when: | ||
| - not __snapshot_snapm_available | d(false) |
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.
This test will always be skipped because __snapshot_snapm_available is not defined
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.
I updated the main.yml to check for:
when: snapshot_lvm_action is defined
to allow the role to be called to just set the variables.
Also, snapm version isn't yet updated on Fedora - so the bootable test will fail until that gets updated (should be this week I think).
This feature is only support on platforms that support snapshot manager (snapm) The bootable flag, when used with the snapm create command, creates a boot menu entry for the snapshot set. This allows the user to select the boot menu entry on reboot that will use the newly created snapshot set. Signed-off-by: Todd Gill <[email protected]>
|
[citest] |
|
I think you need some variable that tells if the platform supports bootable. tests_set_bootable.yml is failing on platforms where snapm is defined but the version is too old to support bootable. |
I've got the following: Currently 0.5.1 is recently released on Fedora. It should be available in RHEL and Centos soon. Would it be reasonable to change to use: ansible.builtin.meta: end_play For example: |
feat: some suggested fixes
|
[citest] |
|
[citest_bad] |
|
[citest] |
|
@trgill afaict, there is no problem in your code - the problem is that tests are not cleaning up which cause subsequent tests to fail - investigating |
|
yep - cleanup - so on platforms where snapm is present but not the right version, we do |
fail the role
|
[citest] |
This feature is only support on platforms that support snapshot manager (snapm)
Enhancement:
The bootable flag, when used with the snapm create command, creates a boot menu entry for the snapshot set. This allows the user to select the boot menu entry on reboot that will use the newly created snapshot set.
Result:
Support for bootable snapsets
Issue Tracker Tickets (Jira or BZ if any):
https://issues.redhat.com/browse/RHEL-106846
Summary by Sourcery
Add support for bootable LVM snapshots via a new snapshot_lvm_bootable flag and provide an experimental option to enable the snapm COPR repository.
New Features:
Enhancements:
Documentation:
Tests: