Skip to content

[libvirt_manager] Add opt-in KVM discard/TRIM support#4005

Open
michburk wants to merge 1 commit into
openstack-k8s-operators:mainfrom
michburk:trim-config
Open

[libvirt_manager] Add opt-in KVM discard/TRIM support#4005
michburk wants to merge 1 commit into
openstack-k8s-operators:mainfrom
michburk:trim-config

Conversation

@michburk

@michburk michburk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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.

@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign valkyrie00 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/ad2ec117a00c4e608a2c43340ddb735e

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 22m 58s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 26m 03s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 42m 50s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 06m 55s
✔️ cifmw-pod-zuul-files SUCCESS in 5m 53s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 9m 38s
✔️ cifmw-pod-pre-commit SUCCESS in 9m 08s
cifmw-molecule-libvirt_manager FAILURE in 20m 49s
✔️ cifmw-molecule-reproducer SUCCESS in 13m 53s

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/6c3910a5366f4bf583218764fe44fa24

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 20m 55s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 29m 03s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 39m 07s
✔️ cifmw-crc-podified-edpm-baremetal-minor-update SUCCESS in 2h 07m 52s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 45s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 36s
✔️ cifmw-pod-pre-commit SUCCESS in 8m 38s
✔️ cifmw-molecule-devscripts SUCCESS in 10m 26s
cifmw-molecule-libvirt_manager FAILURE in 20m 14s
✔️ cifmw-molecule-reproducer SUCCESS in 13m 33s

@michburk michburk force-pushed the trim-config branch 8 times, most recently from 3ed49b8 to 7426d11 Compare June 25, 2026 18:07
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>
@michburk michburk marked this pull request as ready for review June 25, 2026 20:39
@michburk michburk requested a review from a team June 26, 2026 16:27
# License for the specific language governing permissions and limitations
# under the License.

- name: Create fstrim.timer drop-in directory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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: >-

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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.

@Valkyrie00 Valkyrie00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants