Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/devscripts/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ cifmw_devscripts_config_overrides: {}
cifmw_devscripts_installer_timeout: 7200 # 2 hours
cifmw_devscripts_etcd_slow_profile: true
cifmw_devscripts_disable_console: false
cifmw_devscripts_ocp_vm_fstrim: "{{ cifmw_ocp_vm_fstrim | default(false) }}"
cifmw_devscripts_cpu_passthrough: false
6 changes: 6 additions & 0 deletions roles/devscripts/tasks/300_post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
- devscripts_deploy
ansible.builtin.import_tasks: 340_etcd_slow_profile.yml

- name: Set daily fstrim timer on OCP nodes
when: cifmw_devscripts_ocp_vm_fstrim | bool
tags:
- devscripts_deploy
ansible.builtin.import_tasks: 342_fstrim_daily.yml

- name: Prepare for disk overlay configuration
when:
- not cifmw_devscripts_ocp_comply | bool
Expand Down
47 changes: 47 additions & 0 deletions roles/devscripts/tasks/342_fstrim_daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.


- name: Apply daily fstrim timer MachineConfig for masters
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
state: present
definition:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 99-fstrim-daily-master
spec:
config:
ignition:
version: 3.2.0
systemd:
units:
- name: fstrim.timer
enabled: true
contents: |
[Unit]
Description=Discard unused filesystem blocks daily

[Timer]
OnCalendar=daily
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target
1 change: 1 addition & 0 deletions roles/libvirt_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Used for checking if:
* `cifmw_libvirt_manager_vm_users`: (List[Dict]) Used to override the default list of users enabled in the vm. For its format, refers to cloud-init [documentation](https://cloudinit.readthedocs.io/en/latest/reference/modules.html#users-and-groups) about `users`. Defaults to `[]`.
* `cifmw_libvirt_manager_extra_network_configuration`: (Dict) Extra network configuration in nmstate format for the hypervisor. This configuration is applied after creating the libvirt networks, so it can be used to create VLAN interfaces on the libvirt bridges. In addition to nmstate, it also supports a `cifmw_firewall_zone` hint in nmstate interfaces. Defaults to: `{}`.
* `cifmw_libvirt_manager_radvd_networks`: (List[Dict]) List of networks to configure with radvd for IPv6 router advertisements. When defined, the `radvd` role will be included after network creation. Each network definition follows the format documented in the `radvd` role. Defaults to `[]`.
* `cifmw_libvirt_manager_ocp_vm_fstrim`: (Boolean) Add `discard='unmap'` to the libvirt disk driver for OCP VMs, allowing guest TRIM/discard operations to reclaim space on the host qcow2 files. Derives from the master variable `cifmw_ocp_vm_fstrim`. Defaults to `false`.

### `cifmw_libvirt_manager_default_gw_nets` parameter usage

Expand Down
1 change: 1 addition & 0 deletions roles/libvirt_manager/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ cifmw_libvirt_manager_radvd_networks: []

cifmw_libvirt_manager_tmp_inv_file: "{{ ansible_user_dir }}/libvirt_inventory.ini"
cifmw_libvirt_manager_dst_inv_file: "{{ ansible_user_dir }}/libvirt_inventory.yaml"
cifmw_libvirt_manager_ocp_vm_fstrim: "{{ cifmw_ocp_vm_fstrim | default(false) }}"
2 changes: 1 addition & 1 deletion roles/libvirt_manager/templates/domain.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<driver name='qemu' type='qcow2'{% if cifmw_libvirt_manager_ocp_vm_fstrim | default(false) | bool and vm is match('.*ocp.*') %} discard='unmap'{% endif %}/>
<source file='{{ _chdir }}/{{ vm }}.qcow2'/>
{% set disk_bus = vm_data.disk_bus | default('scsi') %}
{% if disk_bus == 'scsi' %}
Expand Down
Loading