[libvirt_manager] Add opt-in KVM discard/TRIM support#4005
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 22m 58s |
|
Build failed (check pipeline). Post ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 20m 55s |
3ed49b8 to
7426d11
Compare
Adds fstrim_enabled per-VM-type param. When true, sets discard='unmap' on the primary disk and schedules daily fstrim.timer in the guest via a systemd drop-in over SSH, for all VM types including OCP/RHCOS. Generated-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Michael Burke <michburk@redhat.com>
| # License for the specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| - name: Create fstrim.timer drop-in directory |
There was a problem hiding this comment.
(absolutely-non-blocking): To avoid repeating code like, become, delegate and remote_user, in every single task. What do you think if we move all into a single block?
- name: Configure fstrim timer in guest
become: true
delegate_to: "{{ _fstrim_target }}"
remote_user: "{{ _fstrim_user }}"
block:
- name: Create fstrim.timer drop-in directory
ansible.builtin.file:
path: /etc/systemd/system/fstrim.timer.d
state: directory
mode: "0755"
..... ecc
| vars: | ||
| _fstrim_target: "{{ (_vm.key | replace('ocp-', '')) }}.{{ inventory_hostname }}" | ||
| _fstrim_user: "{{ 'core' if _vm.key is match('^(crc|ocp).*') else 'zuul' }}" | ||
| loop: >- |
There was a problem hiding this comment.
(non-blocking) It's a bit complicated the loop here, but filters looks ok. I don't know if there are simpler ways to simplify this, but in anyway it's ok.
Adds fstrim_enabled per-VM-type param. When true, sets discard='unmap' on the primary disk and schedules daily fstrim.timer in the guest via a systemd drop-in over SSH.