From 986e35ab4e618509f75bc2f8d4a48941c07a9192 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 17 May 2018 13:47:53 -0500 Subject: [PATCH] Add mount options whenever formatting disks This change provides mount options for all of the file system types we use. These mount options will ensure that the underlying file systems react with the best possible performance when building a test cloud. The main motivation behind this patch is to help resolve bug 1753790 which is causing sporatic failure when gating on RAX test instances that have a secondary data disks. We were providing no options when mounting a secondary disk which results in using the system defaults which may not be very optimal under general workloads. The options have been added to the bootstrap role and will be consistently applied whenever a given FS is used. > Part of this chagne is to modify the FS type for /var/lib/nova. We were using EXT4 and the recommended FS for VM workloads is XFS. > The mount options have largely been derived from the following posts, https://www.phoronix.com/scan.php?page=article&item=linux414-fs-compare&num=1 https://www.phoronix.com/scan.php?page=article&item=linux-415-fs&num=1 Change-Id: I75e00af687d46551e19178604b60665342cf2cae Closes-Bug: #1753790 Signed-off-by: Kevin Carter --- tests/roles/bootstrap-host/defaults/main.yml | 14 +++++++++++++- .../bootstrap-host/tasks/prepare_data_disk.yml | 2 ++ .../tasks/prepare_loopback_btrfs.yml | 2 +- .../tasks/prepare_loopback_machines.yml | 2 +- .../bootstrap-host/tasks/prepare_loopback_nova.yml | 6 +++--- .../bootstrap-host/tasks/prepare_loopback_swap.yml | 2 +- .../tasks/prepare_loopback_swift.yml | 6 +++--- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index 61593cec75..0e56410214 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -236,13 +236,25 @@ bootstrap_host_data_disk2_formats: machinectl: btrfs zfs: zfs btrfs: btrfs + xfs: xfs dir: ext4 lvm: ext2 +# +# Set the data disk mount options. +bootstrap_host_data_mount_options: + machinectl: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_kernel is version_compare('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}" + zfs: "defaults" + btrfs: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_kernel is version_compare('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}" + xfs: "noatime,nodiratime,nobarrier,logbufs=8,logbsize=256k" + ext4: "noatime,nobh,barrier=0,data=writeback" + dir: "defaults" + lvm: "defaults" + swap: "%%" bootstrap_host_data_disk2_fs: "{{ bootstrap_host_data_disk2_formats[lxc_container_backing_store] }}" +bootstrap_host_data_disk2_fs_mount_options: "{{ bootstrap_host_data_mount_options[lxc_container_backing_store] }}" bootstrap_host_data_disk2_path: "{{ (lxc_container_backing_store == 'machinectl' or container_tech == 'nspawn') | ternary('/var/lib/machines', '/var/lib/lxc') }}" - # Boolean option to build Amphora image and certs bootstrap_host_octavia: "{{ (bootstrap_host_scenario in ['octavia']) | bool }}" diff --git a/tests/roles/bootstrap-host/tasks/prepare_data_disk.yml b/tests/roles/bootstrap-host/tasks/prepare_data_disk.yml index 149a3fe1b7..09161d21c7 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_data_disk.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_data_disk.yml @@ -86,6 +86,7 @@ - what: "/dev/{{ _bootstrap_host_data_disk_device }}1" where: "/openstack" type: "ext4" + options: "{{ bootstrap_host_data_mount_options['ext4'] }}" state: 'started' enabled: true tags: @@ -100,6 +101,7 @@ - what: "/dev/{{ _bootstrap_host_data_disk_device }}2" where: "{{ bootstrap_host_data_disk2_path }}" type: "{{ bootstrap_host_data_disk2_fs }}" + options: "{{ bootstrap_host_data_disk2_fs_mount_options }}" state: 'started' enabled: true when: diff --git a/tests/roles/bootstrap-host/tasks/prepare_loopback_btrfs.yml b/tests/roles/bootstrap-host/tasks/prepare_loopback_btrfs.yml index 362f00581b..eebcaeaaaf 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_loopback_btrfs.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_loopback_btrfs.yml @@ -31,7 +31,7 @@ systemd_mounts: - what: "/openstack/lxc-btrfs.img" where: "/var/lib/lxc" - options: "loop" + options: "loop,{{ bootstrap_host_data_mount_options['btrfs'] }}" type: "btrfs" state: 'started' enabled: true diff --git a/tests/roles/bootstrap-host/tasks/prepare_loopback_machines.yml b/tests/roles/bootstrap-host/tasks/prepare_loopback_machines.yml index f414f7dfc4..3731f9cdf2 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_loopback_machines.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_loopback_machines.yml @@ -35,7 +35,7 @@ systemd_mounts: - what: "/openstack/machines.img" where: "/var/lib/machines" - options: "loop,defaults,noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_kernel is version_compare('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}" + options: "loop,{{ bootstrap_host_data_mount_options['btrfs'] }}" type: "btrfs" state: 'started' enabled: true diff --git a/tests/roles/bootstrap-host/tasks/prepare_loopback_nova.yml b/tests/roles/bootstrap-host/tasks/prepare_loopback_nova.yml index 298920ebdd..a59f367e22 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_loopback_nova.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_loopback_nova.yml @@ -22,7 +22,7 @@ - name: Format the Nova file filesystem: - fstype: ext4 + fstype: xfs dev: /openstack/nova.img tags: - nova-format-file @@ -35,8 +35,8 @@ systemd_mounts: - what: "/openstack/nova.img" where: "/var/lib/nova/instances" - options: "loop" - type: "ext4" + options: "loop,{{ bootstrap_host_data_mount_options['xfs'] }}" + type: "xfs" state: 'started' enabled: true tags: diff --git a/tests/roles/bootstrap-host/tasks/prepare_loopback_swap.yml b/tests/roles/bootstrap-host/tasks/prepare_loopback_swap.yml index a1578f59a5..838f934b59 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_loopback_swap.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_loopback_swap.yml @@ -37,7 +37,7 @@ systemd_mounts: - what: "/openstack/swap.img" priority: "0" - options: "%%" + options: "{{ bootstrap_host_data_mount_options['swap'] }}" type: "swap" state: 'started' enabled: true diff --git a/tests/roles/bootstrap-host/tasks/prepare_loopback_swift.yml b/tests/roles/bootstrap-host/tasks/prepare_loopback_swift.yml index e573b9074a..3175956bcf 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_loopback_swift.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_loopback_swift.yml @@ -44,19 +44,19 @@ systemd_mounts: - what: "/openstack/swift1.img" where: "/srv/swift1.img" - options: "loop,noatime,nodiratime,nobarrier,logbufs=8" + options: "loop,{{ bootstrap_host_data_mount_options['xfs'] }}" type: "xfs" state: 'started' enabled: true - what: "/openstack/swift2.img" where: "/srv/swift2.img" - options: "loop,noatime,nodiratime,nobarrier,logbufs=8" + options: "loop,{{ bootstrap_host_data_mount_options['xfs'] }}" type: "xfs" state: 'started' enabled: true - what: "/openstack/swift3.img" where: "/srv/swift3.img" - options: "loop,noatime,nodiratime,nobarrier,logbufs=8" + options: "loop,{{ bootstrap_host_data_mount_options['xfs'] }}" type: "xfs" state: 'started' enabled: true