From 0618bbbe596d4459f5a80be7a06a41186432a4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Wed, 13 Jul 2016 15:57:59 +0200 Subject: =?UTF-8?q?Make=20libvirt=E2=80=99s=20VM=20use=20virtio-scsi=20ins?= =?UTF-8?q?teal=20of=20virtio-blk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main advantage is that virtio-scsi honors TRIM so that deleting files and/or docker images inside the VM now frees disk space on the host by resparsifying the qcow2 file. --- .../libvirt/openshift-cluster/templates/domain.xml | 23 ++++++---------------- .../libvirt/openshift-cluster/templates/user-data | 16 ++++++++++----- 2 files changed, 17 insertions(+), 22 deletions(-) (limited to 'playbooks/libvirt/openshift-cluster') diff --git a/playbooks/libvirt/openshift-cluster/templates/domain.xml b/playbooks/libvirt/openshift-cluster/templates/domain.xml index 8e96cec8d..b645a791a 100644 --- a/playbooks/libvirt/openshift-cluster/templates/domain.xml +++ b/playbooks/libvirt/openshift-cluster/templates/domain.xml @@ -30,22 +30,22 @@ /usr/bin/qemu-system-x86_64 - + - + - + - + - + - + @@ -56,17 +56,6 @@ - - - - - - - - - diff --git a/playbooks/libvirt/openshift-cluster/templates/user-data b/playbooks/libvirt/openshift-cluster/templates/user-data index 8b79940f4..fbcf7c886 100644 --- a/playbooks/libvirt/openshift-cluster/templates/user-data +++ b/playbooks/libvirt/openshift-cluster/templates/user-data @@ -5,7 +5,7 @@ hostname: {{ item[0] }} fqdn: {{ item[0] }}.example.com mounts: -- [ vdb ] +- [ sdb ] users: - default @@ -26,12 +26,18 @@ write_files: permissions: 440 content: | Defaults:openshift !requiretty - - content: | - DEVS=/dev/vdb - VG=docker_vg - path: /etc/sysconfig/docker-storage-setup + - path: /etc/sysconfig/docker-storage-setup owner: root:root permissions: '0644' + content: | + DEVS=/dev/sdb + VG=docker_vg + EXTRA_DOCKER_STORAGE_OPTIONS='--storage-opt dm.blkdiscard=true' + - path: /etc/systemd/system/fstrim.timer.d/hourly.conf + content: | + [Timer] + OnCalendar=hourly runcmd: - NETWORK_CONFIG=/etc/sysconfig/network-scripts/ifcfg-eth0; if ! grep DHCP_HOSTNAME ${NETWORK_CONFIG}; then echo 'DHCP_HOSTNAME="{{ item[0] }}.example.com"' >> ${NETWORK_CONFIG}; fi; pkill -9 dhclient; service network restart + - systemctl enable --now fstrim.timer -- cgit v1.2.3